2010-06-09 77 views

回答

0

无法定制UIActionSheettitle。如果你想要类似的东西,你将不得不设计你自己的克隆。

+0

是的,它是可能的。 http://stackoverflow.com/a/25602552/2459296 – Salim 2014-09-01 09:18:28

+0

@Salim,我不建议列举系统类的私人子视图;他们可以并将在未来的iOS版本中进行更改。 – rpetrich 2014-09-01 19:36:05

2

您可以简单地在UIActionsheet中为按钮设置的名称之后使用空格。例如,如果它是@“下载”,则可以更改为@“下载------------”,其中有空格。

我希望它有效。

+0

不适用于iOS 7 – Kaptain 2014-10-30 12:30:23

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

} 
+0

不,它不起作用。 – ohho 2013-01-08 03:05:28

+0

是的,它的工作原理。我现在在我的一个应用程序中工作。你看到任何错误信息吗? – SpaceDog 2013-01-08 04:07:52

+0

不,没有错误消息。标签仍然居中。 – ohho 2013-01-08 05:01:51

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); 
     } 
    }]; 
} 
+0

您是否已将此应用程序加入应用程序商店? – ullstrm 2015-01-27 11:10:20

+0

是的,现在应用程序在应用程序商店。谢谢 – Salim 2015-01-27 13:13:36