Baby小破孩

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2013年5月30日

摘要: 1.改变UITableViewCell选中时背景色 1. cell.selectedBackgroundView = [[[UIView alloc] initWithFrame:cell.frame] autorelease]; 2. cell.selectedBackgroundView.backgroundColor = [UIColor xxxxxx];2.自定义UITableViewCell选中时背景 1. cell.selectedBackgroundView = [[[UIImageView alloc] initWithImage:[UIImage imageName... 阅读全文
posted @ 2013-05-30 11:57 Baby小破孩 阅读(294) 评论(0) 推荐(0) 编辑

摘要: 在游戏的开发中,一般要用到显示道具或者是筹码的价格,为了显示优惠幅度和吸引玩家付费,一般会强调原价与现价的优惠幅度,原价上面画上一条删除线。下面是在iOS开发时用到的代码,可以作为参考实现。===========================================================================下面是UILabelStrikeThrough.h文件/* * 用于在UILabel上画删除线 */#import<Foundation/Foundation.h>@interface UILabelStrikeThrough :UILabel{ 阅读全文
posted @ 2013-05-30 11:56 Baby小破孩 阅读(254) 评论(0) 推荐(0) 编辑

摘要: ASIHTTPRequest-详解ASIHTTPRequest 是一款极其强劲的 HTTP 访问开源项目。让简单的 API 完成复杂的功能,如:异步请求,队列请求,GZIP 压缩,缓存,断点续传,进度跟踪,上传文件,HTTP 认证。在新的版本中,还加入了 Objective-C 闭包 Block 的支持,让我们的代码加轻简灵活。 下面就举例说明它的 API 用法。发起一个同步请求 同步意为着线程阻塞,在主线程中使用此方法会使应用Hang住而不响应任何用户事件。所以,在应用程序设计时,大多被用在专门的子线程增加用户体验,或用异步请求代替(下面会讲到)。 - (IBAction)... 阅读全文
posted @ 2013-05-30 11:54 Baby小破孩 阅读(125) 评论(0) 推荐(0) 编辑

摘要: 若是要移除一个 UIView 的所有子视图,SDK 里没有 remove all 之类的办法。可以用 for loop 轮回调用 – removeFromSuperview 来移除 例如:for(UIView *view in [self.view subviews]) { [view removesuperview]; }若是要移动指定的视图,可以如许: for(UIView *mylabelview in [self.view subviews]) { if ([mylabelview isKindOfClass:[UILabel class]]) { ... 阅读全文
posted @ 2013-05-30 11:54 Baby小破孩 阅读(187) 评论(0) 推荐(0) 编辑

摘要: 1. 1。然后导入JSONKit.h “在您的。 m文件,在任何你需要解析JSON响应导入“ JSONKit.h ” 2。只要你有JSON数据,你需要解析(如何获得一些后) ,你只需要使用像这样的objectFromData方法 2. NSData* jsonData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];NSDictionary *resultsDictionary = [jsonData objectFromJSONData]; 3. 阅读全文
posted @ 2013-05-30 11:53 Baby小破孩 阅读(160) 评论(0) 推荐(0) 编辑

摘要: @interface Set_starViewController : UIViewController<UIPickerViewDelegate>{UIPickerView *pickerview;UILabel *contentview;NSArray *content;//星座id _delegate;int _type;}-(id)initWithDelegate:(id)delegate type:(int)type;- (void)setString:(id)sender;@end // Set_starViewController.m... 阅读全文
posted @ 2013-05-30 11:52 Baby小破孩 阅读(189) 评论(0) 推荐(0) 编辑

摘要: NSString *backgroudpath = [[NSBundle mainBundle] pathForResource:@"backgroud" ofType:@"png"]; UIImage *backgroudImage = [UIImage imageWithContentsOfFile:backgroudpath]; self.view.backgroundColor=[UIColor colorWithPatternImage:backgroudImage] ; 阅读全文
posted @ 2013-05-30 11:51 Baby小破孩 阅读(724) 评论(0) 推荐(0) 编辑

摘要: 1.UITextField的初始化和设置 textField = [[UITextField alloc] initWithFrame:CGRectMake(120.0f, 80.0f, 150.0f, 30.0f)]; [textField setBorderStyle:UITextBorderStyleRoundedRect]; //外框类型 textField.placeholder = @"password"; //默认显示的字 textField.secureTextEntry = YES; //密码 textField.autocorrectionType = 阅读全文
posted @ 2013-05-30 11:49 Baby小破孩 阅读(100) 评论(0) 推荐(0) 编辑

摘要: 01//创建uilabel02UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(20, 40, 280, 80)];03 04//设置背景色05label1.backgroundColor = [UIColor grayColor];06 07//设置tag08label1.tag = 91;09 10//设置标签文本11label1.text = @"Hello world!";12//设置标签文本字体和字体大小13label1.font = [UIFont fontWithName:@"Ar 阅读全文
posted @ 2013-05-30 11:48 Baby小破孩 阅读(180) 评论(0) 推荐(0) 编辑

摘要: [view_button addTarget:self action:@selector(dragBegan:withEvent: ) forControlEvents: UIControlEventTouchDown];[view_button addTarget:self action:@selector(dragMoving:withEvent: ) forControlEvents: UIControlEventTouchDragInside];[view_button addTarget:self action:@selector... 阅读全文
posted @ 2013-05-30 11:46 Baby小破孩 阅读(195) 评论(0) 推荐(0) 编辑