- 计算string串的像素长度:
1 CGSize polLabelSize = [polName sizeWithFont:[UIFont boldSystemFontOfSize:16] constrainedToSize:CGSizeMake(MAXFLOAT, MAXFLOAT)];
2 CGSize podLabelSize = [podName sizeWithFont:[UIFont boldSystemFontOfSize:16] constrainedToSize:CGSizeMake(MAXFLOAT, MAXFLOAT)];
3 float polLabelWidth = (polLabelSize.width <= 125) ? polLabelSize.width : 125;
4 float podLabelWidth = (podLabelSize.width <= 125) ? podLabelSize.width : 125;
5 [polLabel setFrame:CGRectMake(10, 0, polLabelWidth, 32)];
6 [pageHeaderArrow setFrame:CGRectMake(polLabelWidth + 20, 7, 30, 20)];
7 [podLabel setFrame:CGRectMake(polLabelWidth + 60, 0, podLabelWidth, 32)]; - 使用图片设置View的背景
1 [self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"bg.png"]]];
2 [self.table setBackgroundColor:[UIColor clearColor]]; - 读取自定义的Cell的方法
1 static NSString *CellIdentifier = @"Cell";
2 HistoricalReliablityViewCellStyle *cell = (HistoricalReliablityViewCellStyle *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
3 if(cell == nil)
4 {
5 NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"HistoricalReliablityViewCellStyle" owner:self options:nil];
6 cell = [nib objectAtIndex:0];
7 cell.selectionStyle = UITableViewCellSelectionStyleNone;
8 } - 获取屏幕的边界
CGRect screenBounds = [[UIScreen mainScreen]bounds];
CGRect screenBounds = [[UIScreen mainScreen]applicationFrame];
- 计算string串的像素长度: