作者markzog21 (残羽星辰)
看板MacDev
标题Re: [问题] 如何等待alert结束?
时间Fri Sep 3 16:27:49 2010
- (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)
1F:→ zonble:你的 tableview datasource 怎麽写的? 09/03 18:24