Re: [問題] 如何等待alert結束?
- (Learning_userdefine *) init
{
if ((self = [super initWithStyle:UITableViewStylePlain]))
self.title = @"Word";
if (sectionArray == nil)
sectionArray = [[NSMutableArray alloc] init];
if (sectionNameArray == nil)
sectionNameArray = [[NSMutableArray alloc] init];
return self;
}
- (void)viewDidLoad {
// create a toolbar to have two buttons in the right
UIToolbar* tools = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 110, 44.01)];
// create the array to hold the buttons, which then gets added to the toolbar
NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:2];
//
UIBarButtonItem* bi = [[UIBarButtonItem alloc]initWithTitle:@"新字彙夾"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(addsectionbutton)];
[buttons addObject:bi];
[bi release];
// create a standard "add" button
bi =[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(add)];
[buttons addObject:bi];
[bi release];
// stick the buttons in the toolbar
[tools setItems:buttons animated:NO];
[buttons release];
// and put the toolbar in the nav bar
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:tools];
[tools release];
action:@selector(addsectionbutton) ];
[super viewDidLoad];
}
- (void) addsectionbutton{
UIAlertView *baseAlert = [[UIAlertView alloc]
initWithTitle:@"新資料夾" message:@"輸入名稱"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"OK", nil];
[baseAlert addTextFieldWithValue:@"" label:@"Enter NewFile Name"];
TextField = [baseAlert textFieldAtIndex:0];
TextField.clearButtonMode = UITextFieldViewModeWhileEditing;
TextField.keyboardType = UIKeyboardTypeAlphabet;
TextField.keyboardAppearance = UIKeyboardAppearanceAlert;
TextField.autocapitalizationType = UITextAutocapitalizationTypeWords;
TextField.autocorrectionType = UITextAutocorrectionTypeNo;
[baseAlert show];
[baseAlert release];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 1) {// Press OK button
[sectionArray addObject:[[NSMutableArray alloc] init]];
[[sectionArray objectAtIndex:0] addObject:[NSString stringWithFormat:@"%@",TextField.text]];
[sectionNameArray addObject: [NSString stringWithFormat:@"%@", TextField.text]];
[self.tableView reloadData];
}
}
--
[請問] 吹風機插頭一直不拔會不會怎樣
推 eggimage:= = 建議千萬別這樣做..上次有人這樣 結果佔用一個插座.. 10/26 08:05
推 WhatCanIDo:樓上..然後呢@@ 10/26 08:07
推 eggimage:就少一個插座用 很不方便.. 10/26 08:08
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 203.64.83.7
※ 編輯: markzog21 來自: 203.64.83.7 (09/03 16:32)
→
09/03 18:24, , 1F
09/03 18:24, 1F
討論串 (同標題文章)
完整討論串 (本文為第 6 之 8 篇):
MacDev 近期熱門文章
PTT數位生活區 即時熱門文章