随笔分类 - 06 控件·UI
摘要:问题:两个tableview 在同一个页面时,出现自动合并的现象问题代码:-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *cellIdetify = @"cell"; UITableViewCell *tvCell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentif...
阅读全文
摘要:UILabel 多行文字自动换行 (自动折行)1.UIView *footerView = [[UIView alloc] initWithFrame:CGRectMake(10, 100, 300, 180)]; 2. UILabel *label = [[UILabel alloc] ...
阅读全文
摘要://让单元格无法被选中-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *cellIdetify = @"cell"; UITableViewCell *tvCell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdetify] autorelease];
阅读全文
摘要://此处设定的大小是指scrollView的大小 scrView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 44, 320, 417)]; //核心:表示可滑动区域的大小 其实就是scrView中所有内容的总高度 ...
阅读全文
摘要:@protocol UIScrollViewDelegate几个概念的理解:contentSize:可滑动区域的大小 (即这个区域内的内容是可以滑动的!scrollview的frame 表示所有可滑动的内容,都在这个frame中进行滑动)例子: scrView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 44, 320, 417)]; [scrView setContentSize:CGSizeMake(320,(220+heightOfTabFirst+CELL_CONTENT_MARGIN+heightOfTabSecond+CEL
阅读全文
摘要:- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;{ NSString *text = [items objectAtIndex:[indexPath row]]; //下句中(CELL_CONTENT_WIDTH - (CELL_CONTENT_MARGIN * 2) 表示显示内容的label的长度 ,20000.0f 表示允许label的最大高度 CGSize constraint = CGSizeMake(CELL_CONT...
阅读全文
摘要:给UIImage添加圆角,也可用于CCSprite//给图片添加圆角显示- (UIImage *) roundCorners: (UIImage*) img{ int w = img.size.width; int h = img.size.height; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace, kCGImageAlphaPremulti...
阅读全文
摘要:1、UILabel字体加粗 IOS加粗;[UILabelsetFont:[UIFontfontWithName:@"Helvetica-Bold"size:20]];加粗并且倾斜[UILabelsetFont:[UIFontfontWithName:@"Helvetica-BoldOblique"size:20]];2、分享一个可垂直顶端对齐的UILabelhttp://www.devdiv.com/分享一个可垂直顶端对齐的UILabel-weblog-64796-7239.html/* Accessing the Text Attributes tex
阅读全文
摘要:删除一个视图的全部子视图 NSArray *views = [self.view subviews]; UIView *view; for(view in views) { [view removeFromSuperview]; }删除某个视图的指定视图 //依次遍历self.view中的所有子视图 for(id tmpView in [self.view subviews]) { //找到要删除的子视图的对象 if([tmpView isKindOfClass:[UIImageView class]])...
阅读全文
摘要:场景:有一个页面,很长,自然要将UIScrollView作为view的子视图,然后,将所有的页面元素添加到UIScrollView中。要为UIScrollView设置自适应的背景图片。贴代码:UIScrollView*scrollView=[[UIScrollViewalloc]initWithFrame:CGRectMake(0,0,320,480)];scrollView.backgroundColor= [UIColorcolorWithPatternImage:[UIImageimageNamed:@"你要设置的背景图片名称320*xx"]];[scrollView
阅读全文
摘要:- (CGSize)sizeThatFits:(CGSize)size; // return 'best' size to fit given size. does not actually resize view. Default is return existing view size- (v...
阅读全文
摘要:当内容不足以将整个Label占满的时候,可以将Label中的内容顶部对齐显示,并自适应大小。1、给myLabel标签内填充文本Ios代码myLabel.text=@"thetextwillfillthelabel";2、设置myLabel的最大显示行数(0表示不限)Ios代码myLabel.numberOfLines=0;3、设置myLabel框架的最大尺寸Ios代码myLabel.frame=CGRectMake(50,80,60,150);4、调用sizeToFit减小frame框架的尺寸,以使得myLabel框架的大小适应其中填充的内容Ios代码myLabel.siz
阅读全文
摘要:转自:http://unmi.cc/use-uiscrollview
阅读全文
摘要:目标效果:样式代码: UILabel *labJzmcTitle = [[UILabel alloc]init]; [labJzmcTitle setBackgroundColor:[UIColor clearColor]]; labJzmcTitle.text=@"基站名称:"; [labJzmcTitle setTextColor:[UIColor whiteColor]]; labJzmcTitle.frame = CGRectMake(6, i*210+45, 80, 30)...
阅读全文
摘要:iOS开发UIViewController内存管理是本文要介绍的内容,在iOS3.0 后,UIViewController多了一个叫做 viewDidUnLoad 的方法。不少人都不清楚这个方法的具体意义,苹果的文档也就一句 ”Called when the controller’s view is released from memory” 简单的解释了下,并要求你把 IBOutlet 绑定的视图给清空,为什么呢? 先看下UIViewController从创建 view 到展示的流程的几个函数 -initWithNibName:bundle: 这两个方法都是初始化一个 vc,但请注意 ...
阅读全文
摘要:转自:http://unmi.cc/uiwebview-replace-uitextview-line-height
阅读全文
摘要:1、使用UITextView 让字符串自动换行(字符串中包含\r\n) UITextView *uitv_remark = [[UITextView alloc]initWithFrame:CGRectMake(10, 48, 220, 420)]; uitv_remark.text = [[NSString alloc]initWithFormat:[member objectForKey:@"description"]]; [uitv_remark setFont:[UIFont systemFontOfSize:15]];...
阅读全文
摘要:iPhone/iOS图片读取、保存、绘制http://blog.csdn.net/jerryvon/article/details/7526147
阅读全文
摘要:当CommonAlert.m中的方法执行的快时,alertView的显示和消失是正常的。如下所示:2013-01-24 23:31:59.978 点餐系统[5649:707] 进入OrderListViewController.m的-(IBAction)btnTaocanMenuClicked:(id)sender2013-01-24 23:31:59.982 点餐系统[5649:707] 进入CommonAlert.m的startAlertView2013-01-24 23:31:59.986 点餐系统[5649:5e0b] 进入CommonAlert.m的startAlertProcess
阅读全文
浙公网安备 33010602011771号