2014-10-16 81 views
0

非常簡單,我希望UI操作表的標題是兩行。UIActionSheet標題多行

請參閱下面的示例。我想使它:

(一號線)動作

(2號線)表演示

仍然爲中心,一切都只是用回車

enter image description here

+0

你嘗試把一個'\ N'在您的標題? – rmaddy 2014-10-16 15:47:36

+0

你需要使用** \ r **,因爲它是NSString *,它的新行是\ r(carrage-return) – 2014-10-16 15:56:32

回答

1

是因爲它takes NSString *您需要使用\r

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"First Line\rSecond Line", nil) 
                 delegate:self 
               cancelButtonTitle:NSLocalizedString(@"_CANCEL", nil) 
              destructiveButtonTitle:nil 
               otherButtonTitles:NSLocalizedString(@"_USE_SYSTEM_LANGUAGE", nil), NSLocalizedString(@"_ENGLISH", nil), NSLocalizedString(@"_ARABIC", nil), nil]; 

是複製粘貼&我用NSLocalizedString,但你NCAT使用NSString

See picture:

+0

樂意幫忙:) – 2014-10-16 16:08:43

+1

擺脫'\ r'兩邊的空間。順便說一句 - '\ n'也可以。 – rmaddy 2014-10-16 16:42:10

+0

@rmaddy昨天我在iOS 8下有'\ n'越野車,'\ r'解決了我的問題。 – 2014-10-16 22:25:04