您好,登錄后才能下訂單哦!
1、UITableView:
UITableViewDelegate 新增內容:
// Use the estimatedHeigh(估算高度)t methods to quickly calcuate guessed values which will allow for fast load times of the table.
// If these methods are implemented, the above -tableView:heightForXXX calls will be deferred until views are ready to be displayed, so more expensive logic can be placed there.
- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return50;
} // 這個方法先返回一個估算的cell高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{ kPrintInfo
return40;
} 然后這個方法才返回真正的cell高度
這兩個方法同理
- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForHeaderInSection:(NSInteger)section;
- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForFooterInSection:(NSInteger)section;
新增屬性:
@property(nonatomic) CGFloat estimatedRowHeight ;// default is 0, which means there is no estimate
@property(nonatomic) CGFloat estimatedSectionHeaderHeight ;// default is 0, which means there is no estimate
@property(nonatomic) CGFloat estimatedSectionFooterHeight ;// default is 0,
通過新增代理放大不難知道,上述三個新增屬性不難理解了。
// the background color of the section index while not being touched(當section不被觸摸時候的背景顏色)
@property(nonatomic,retain)UIColor *sectionIndexBackgroundColor;
2、UIButton:
UIButton的這個屬性是 IOS6引入的,以前沒注意到:
- (void)setAttributedTitle:(NSAttributedString *)title forState:(UIControlState)stateNS_AVAILABLE_IOS(6_0);// default is nil. title is assumed to be single line
用法如下:- (NSMutableAttributedString *) getString
{
NSMutableAttributedString *attriString = [[NSMutableAttributedStringalloc]initWithString:@"this is test!"];
//改變this的字體,value必須是一個CTFontRef
[attriString addAttribute:(NSString *)kCTFontAttributeName
value:CFBridgingRelease(CTFontCreateWithName((CFStringRef)[UIFontboldSystemFontOfSize:14].fontName,14,NULL))
range:NSMakeRange(0,4)];
//給this加上下劃線,value可以在指定的枚舉中選擇
[attriString addAttribute:(NSString *)kCTUnderlineStyleAttributeName
value:(id)[NSNumbernumberWithInt:kCTUnderlineStyleDouble]
range:NSMakeRange(0,4)];
return attriString;
}
- (void)viewDidLoad
{
[superviewDidLoad];
[btsetAttributedTitle:[selfgetString]forState:UIControlStateNormal];
}
3、UIDatePicker:
不想說什么了~
4、UISteper:
- (void)viewDidLoad
{
[superviewDidLoad];
UIStepper *myStepper = [[UIStepperalloc] initWithFrame:CGRectMake(0, 10, 320, 50)];
myStepper.backgroundColor = [UIColorredColor];
[myStepper addTarget:self
action:@selector(myAction:)
forControlEvents:UIControlEventValueChanged];
[self.viewaddSubview:myStepper];
}
- (void) myAction:(UIStepper *) sender
{
CFShow((__bridgeCFTypeRef)(@(sender.value)));
}
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。