我试图创建一个东西,以列出与设备连接的用户的所有Twitter帐户在UIActionSheet
中。例如,我的设备上有三个Twitter帐户。我想要操作表格列出我的帐户并附带取消按钮。目前,我的函数如下:
- (void)showAlertViewForAccounts:(NSArray*)accounts {
accounts = _.arrayMap(accounts, ^id(ACAccount *account) {
return account.username;
});
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Choose an account:"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:nil];
for (NSString *username in accounts) {
[actionSheet addButtonWithTitle:username];
}
[actionSheet showInView:[[[[[UIApplication sharedApplication] delegate] window] rootViewController] view]];
}
我的问题是取消按钮没有显示在操作表的单独“section”中。
有没有办法将accounts
数组转换为va_list
,以便作为UIActionSheet
init...
方法的参数传递,或者指定取消按钮应该显示在单独的“section”中?