Is there any way to change the title font size in a UIActionSheet?

pirey4 picture pirey4 · Oct 13, 2010 · Viewed 10.1k times · Source

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.

Answer

conecon picture conecon · Jun 6, 2011

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];