摘要: iphone重用机制是苹果为了实现大量数据显示而采用的一种节省内存的机制,但是在实际使用过程中,会有以下问题:1、使用addSubView在每项上添加视图的时候会有重叠的现象。例如,UITableView中的Cell ,如果在cell上添加视图,则在使用苹果的重用机制的时候,会重现重叠的现象。刚开始学习的时候,觉得这个重用不太合适,原因:在数据不是很多的时候,个人觉得使用不使用重用机制都可以,于是乎,干脆放弃使用这套机制。代码如下: UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifi 阅读全文
posted @ 2012-10-24 17:34 coderguo 阅读(341) 评论(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]]) { [mylabelview removeFromS 阅读全文
posted @ 2012-10-24 16:27 coderguo 阅读(1935) 评论(0) 推荐(0) 编辑
摘要: 详细使用:UILabel *label = [[UILabelalloc] initWithFrame:CGRectMake(0, 0, 75, 40)]; //声明UIlbel并指定其位置和长宽label.backgroundColor = [UIColorclearColor]; //设置label的背景色,这里设置为透明色。label.font = [UIFont fontWithName:@"Helvetica-Bold" size:13]; //设置label的字体和字体大小。 label.transform = CGAffineTransformMakeRota 阅读全文
posted @ 2012-10-24 11:15 coderguo 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 详细使用:UILabel *label = [[UILabelalloc] initWithFrame:CGRectMake(0, 0, 75, 40)]; //声明UIlbel并指定其位置和长宽label.backgroundColor = [UIColorclearColor]; //设置label的背景色,这里设置为透明色。label.font = [UIFont fontWithName:@"Helvetica-Bold" size:13]; //设置label的字体和字体大小。 label.transform = CGAffineTransformMakeRota 阅读全文
posted @ 2012-10-24 11:14 coderguo 阅读(244) 评论(0) 推荐(0) 编辑