1

是否可以左对齐titlea 的文本UIActionSheet?谢谢!

4

4 回答 4

1

您可以在 UIActionsheet 中为按钮设置的名称后简单地使用空格。例如,如果它是@"download",您可以更改为@"Download------------",这里的破折号是空格。

我希望它有效。

于 2012-07-15T05:39:19.287 回答
0

是的,你可以做到。

NSArray *subViewArray = yourActionSheet.subviews;
for(int x=0;x<[subViewArray count];x++){
    if([[[subViewArray objectAtIndex:x] class] isSubclassOfClass:[UILabel class]])
    {
        UILabel *label = [subViewArray objectAtIndex:x];
        label.textAlignment = NSTextAlignmentLeft;
    }

}
于 2013-01-07T18:06:36.823 回答
0

无法自定义title. UIActionSheet如果您想要类似的东西,则必须设计自己的克隆。

于 2010-06-09T03:32:29.107 回答
0

对的,这是可能的

- (void)willPresentActionSheet:(UIActionSheet *)actionSheet {
    [actionSheet.subviews enumerateObjectsUsingBlock:^(id _currentView, NSUInteger idx, BOOL *stop) {
        if ([_currentView isKindOfClass:[UIButton class]]) {
            ((UIButton *)_currentView).contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
            ((UIButton *)_currentView).contentEdgeInsets = UIEdgeInsetsMake(0, 30, 0, 0);
        }
    }];
}
于 2014-09-01T09:18:06.190 回答