為柯坪等地區(qū)用戶提供了全套網(wǎng)頁設(shè)計(jì)制作服務(wù),及柯坪網(wǎng)站建設(shè)行業(yè)解決方案。主營業(yè)務(wù)為成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站制作、柯坪網(wǎng)站設(shè)計(jì),以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務(wù)。我們深信只要達(dá)到每一位用戶的要求,就會(huì)得到認(rèn)可,從而選擇與我們長期合作。這樣,我們也可以走得更遠(yuǎn)!> 1 //修改彈出對(duì)話框的樣式 2 alertView.alertViewStyle = UIAlertViewStylePlainTextInput;
3
4 //根據(jù)索引獲取指定的某個(gè)文本框 5 [alertView textFieldAtIndex :0]
6 [alertView textFieldAtIndex :0].text = her.name;
7
8 //通過UIAlertView的代理來監(jiān)聽對(duì)話框中的按鈕的點(diǎn)擊事件
9 //實(shí)現(xiàn)UIAlertView的10 -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex 代理方法
實(shí)例代碼: 1 -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
2 CZHero *hero = self.heros[indexPath.row];
3 UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"提示" message:nil delegate:self cancelButtonTitle:@"取消" otherButtonTitels:@"確定",nil];
4
5 alertView.alertViewStyle = UIAlertViewStylePlainTextInput;
6 [alertView textFieldAtIndex:0].text = hero.name;
7
8 //記錄當(dāng)前點(diǎn)擊行的行號(hào) 9 alertView.tag = indexPath.row;
10 [alertView show]
11 }
12
13 #pragma mark - alertView的代理方法
14 -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger) buttonIndex{
15 //判斷點(diǎn)擊的是哪個(gè)按鈕16 if(buttonIndex ==1){
17 //獲取文本框中的數(shù)據(jù)18 NSString *name = [alertView textFieldAtIndex:0].text;
19
20 //修改模型數(shù)據(jù)
21 //根據(jù)行號(hào),獲取當(dāng)前點(diǎn)擊行的模型數(shù)據(jù)22 CZHero *hero = self.heros[alertView.tag];
23 hero.name = name;
24
25 //重新刷新TableView數(shù)據(jù)
26 //重新刷新整個(gè)TableView,UITableView會(huì)重新向 datasource請(qǐng)求數(shù)據(jù)
27 //重新調(diào)用數(shù)據(jù)源方法
28 //[self.tableView reloadData];//不好重新刷新整個(gè)TableView
29
30 //局部刷新
31 //創(chuàng)建一個(gè)indexPath對(duì)象32 NSIndexPath *path = [NSIndexPath indexPathForRow:alertView.tag inSection:0];
33
34 [self.tableView reloadRowsAtIndexPaths:@[path] withRowAnimation:UITableViewRowAnimationLeft];
35 }
36 }
標(biāo)題名稱:IOS對(duì)話框UIAlertView-創(chuàng)新互聯(lián)
文章出自:http://aaarwkj.com/article36/piipg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供手機(jī)網(wǎng)站建設(shè)、定制開發(fā)、全網(wǎng)營銷推廣、網(wǎng)站導(dǎo)航、動(dòng)態(tài)網(wǎng)站、靜態(tài)網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
移動(dòng)網(wǎng)站建設(shè)知識(shí)