Я пытаюсь создать небольшой пользовательский интерфейс UIActionSheet. Я хочу отображать большой текст в кнопке UIActionSheet. Этот код отлично работает под iOS 8, но в iOS 8 - (void) willPresentActionSheet: (UIActionSheet *) actionSheet {
for (UIView *subview in actionSheet.subviews) {
if ([subview isKindOfClass:[UIButton class]]) {
UIButton *button = (UIButton *)subview;
UIFont *textFont=[UIFont fontWithName:@"Palatino-Roman" size:12.0];
button.titleLabel.font=textFont;
button.titleLabel.numberOfLines=4;
[button setContentHorizontalAlignment:UIControlContentVerticalAlignmentCenter];
constrainedToSize:constraint1 lineBreakMode:NSLineBreakByWordWrapping];
[button setFrame:CGRectMake(button.frame.origin.x+4,button.frame.origin.y+2,button.frame.size.width-4, button.frame.size.height)];
if([[UIDevice currentDevice] systemVersion].floatValue<=5.0)
{
button.titleLabel.lineBreakMode = UILineBreakModeWordWrap;
button.titleLabel.textAlignment = UITextAlignmentCenter;
}
else
{
button.titleLabel.lineBreakMode = NSLineBreakByWordWrapping;
button.titleLabel.textAlignment = NSTextAlignmentCenter;
}
}
}
}