Ios 动态UIActionSheet';其他按钮:和#x27;
我正在尝试创建一些东西,以便在Ios 动态UIActionSheet';其他按钮:和#x27;,ios,twitter,uiactionsheet,acaccount,Ios,Twitter,Uiactionsheet,Acaccount,我正在尝试创建一些东西,以便在UIActionSheet中列出用户连接到设备的所有Twitter帐户。例如,我的设备上有三个Twitter帐户。我想在行动表上用“取消”按钮列出我的帐户。目前,我的函数如下所示: - (void)showAlertViewForAccounts:(NSArray*)accounts { accounts = _.arrayMap(accounts, ^id(ACAccount *account) { return account.usern
UIActionSheet
中列出用户连接到设备的所有Twitter帐户。例如,我的设备上有三个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]];
}
我的问题是取消按钮没有显示在行动表的单独“部分”
我是否可以A.)将
账户
数组转换为va_列表
,作为ui操作表
init…
方法的参数传入,或B.)指定取消按钮应显示在单独的“部分”中?在其他按钮之后添加取消按钮:
- (void)showAlertViewForAccounts:(NSArray*)accounts {
accounts = _.arrayMap(accounts, ^id(ACAccount *account) {
return account.username;
});
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Choose an account:"
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil];
for (NSString *username in accounts) {
[actionSheet addButtonWithTitle:username];
}
actionSheet.cancelButtonIndex = [actionSheet addButtonWithTitle:@"Cancel"];
[actionSheet showInView:[[[[[UIApplication sharedApplication] delegate] window] rootViewController] view]];
}
令人惊叹的。谢谢你的快速回复@JoeBlow-最好用这么多代码发布你自己的答案,而不是把它全部添加到我的答案中。