摘要: 1、修改UISearchBar的背景颜色UISearchBar是由两个subView组成的,一个是UISearchBarBackGround,另一个是UITextField. 要IB中没有直接操作背景的属性。方法是直接将 UISearchBarBackGround移去seachBar=[[UISearchBaralloc]init]; seachBar.backgroundColor=[UIColorclearColor]; for(UIView*subviewinseachBar.subviews){if([subviewisKindOfClass:NSClassFromString(@&q 阅读全文
posted @ 2012-11-20 15:52 Kristen 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 1.取消cell点击变色cell.selectionStyle = UITableViewCellSelectionStyleNone;2.禁止边缘滑动(类似到顶端仍可拖动一小节)talbeview.bounces = NO;3.设置分界线颜色tableView.separatorColor =[UIColor clearColor];//透明,达到没有分界线效果4.标题Label加载在View上 return View时 才能实现自定义Label的frame, return label不能改变frame5.获得当前屏幕显示的所有行[mTableView indexPathsForVisibl 阅读全文
posted @ 2012-11-20 15:45 Kristen 阅读(711) 评论(0) 推荐(0) 编辑
摘要: 系统至ios6之后,关于图片拉伸的方法已经扩展至3个函数: 1.ios4提供的方法: - (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight 这个函数是UIImage的一个实例函数,它的功能是创建一个内容可拉伸,而边角不拉伸的图片,需要两个参数,第一个是不拉伸区域距离左边框的宽度,第二个参数是不拉伸区域距离上边框的宽度,其操作本质是对一个像素的复制拉伸,故没有渐变效果,这也是其缺点所在。 参数的意义是,如果参数指定10,5。那么... 阅读全文
posted @ 2012-11-20 12:33 Kristen 阅读(1756) 评论(0) 推荐(0) 编辑
摘要: //测量字符串长度, 两个参数都可以固定或者不固定 CGSize size = [text sizeWithFont:font constrainedToSize:CGSizeMake(150.0f, MAXFLOAT) lineBreakMode:UILineBreakModeWordWrap];2.换行方式UILineBreakModeWordWrap=0,以单词为单位换行,以单位为单位截断。UILineBreakModeCharacterWrap,以字符为单位换行,以字符为单位截断。UILineBreakModeClip,以单词为单位换行。以字符为单位截断。UILineBreakMo.. 阅读全文
posted @ 2012-11-20 12:25 Kristen 阅读(1087) 评论(0) 推荐(0) 编辑
摘要: 1.获取系统得时间与日期NSString* date;NSDateFormatter* formatter = [[NSDateFormatteralloc]init]; [formattersetDateFormat:@"YYYY-MM-dd%20hh:mm:ss"]; date = [formatterstringFromDate:[NSDatedate]];2.分开获得/获得系统时间NSDate*senddate=[NSDatedate];NSDateFormatter*dateformatter=[[NSDateFormatteralloc]init];[datef 阅读全文
posted @ 2012-11-20 12:19 Kristen 阅读(175) 评论(0) 推荐(0) 编辑
摘要: //button的长按事件 UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizeralloc] initWithTarget:selfaction:@selector(btnLong:)]; //长按时间 longPress.minimumPressDuration = 0.8; [button addGestureRecognizer:longPress];#pragma mark -#pragma mark Table Delegate Methods- (NSInteger)tableVie... 阅读全文
posted @ 2012-11-20 12:18 Kristen 阅读(1517) 评论(0) 推荐(1) 编辑
摘要: 1.//用画图的方式设置圆角mImageView.image=[UIImage imageNamed:@"bg1.png"]; mImageView.frame=CGRectMake(center.x-radius, center.y-radius, 2*radius, 2*radius); mImageView.layer.cornerRadius=radius;//设置圆角半径 mImageView.layer.masksToBounds=YES; [mImageView.layer setBorderWidth:1];//设置边框宽度 [mImageView.laye 阅读全文
posted @ 2012-11-20 12:16 Kristen 阅读(2681) 评论(0) 推荐(1) 编辑
摘要: //设置边框样式,只有设置了才会显示边框样式 text.borderStyle = UITextBorderStyleRoundedRect; typedef enum { UITextBorderStyleNone, UITextBorderStyleLine, UITextBorderStyleBezel, UITextBorderStyleRoundedRect } UITextBorderStyle;//设置输入框的背景颜色,此时设置为白色如果使用了自定义的背景图片边框会被忽略掉 text.backgroundColor = [UIColor whiteColor];//设... 阅读全文
posted @ 2012-11-20 12:10 Kristen 阅读(337) 评论(0) 推荐(0) 编辑