有没有办法在UIActionSheet中更改标题字体大小?
问题描述:
字体非常小,有些人难以阅读,所以我想让它更接近下面按钮上使用的字体大小。
The font is very small and hard for some to read so I'd like to make it closer to the font size used on the buttons below it.
答
您可以在show方法之后更改字体属性(如showFromBarButtonItem),如下所示。
You can change font property after show method(like showFromBarButtonItem) as below.
CGRect oldFrame = [(UILabel*)[[sheet subviews] objectAtIndex:0] frame];
UILabel *newTitle = [[[UILabel alloc] initWithFrame:oldFrame] autorelease];
newTitle.font = [UIFont boldSystemFontOfSize:17];
newTitle.textAlignment = UITextAlignmentCenter;
newTitle.backgroundColor = [UIColor clearColor];
newTitle.textColor = [UIColor whiteColor];
newTitle.text = @"My Title";
[sheet addSubview:newTitle];
[sheet release];