亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 學院 > 開發設計 > 正文

從零開始學ios開發(十五):NavigationControllersandTableViews(中)

2019-11-14 20:20:04
字體:
來源:轉載
供稿:網友

這篇內容我們繼續上一篇的例子接著做下去,為其再添加3個table view的例子,有了之前的基礎,學習下面的例子會變得很簡單,很多東西都是舉一反三,稍稍有些不同的內容,好了,閑話少說,開始這次的學習。

如果沒有上一篇的代碼,可以從這里下載Nav_1

1)第三個subtableview:Controls on Table Rows
這個例子,我們將為每個table view的每一行添加一個按鈕,這個按鈕將放在accessory icon的位置(之前我們使用過accessoryType,其實這也是一個view,可以容納其他的view,因此我們將一個button放在其中,然后accessory icon的位置上就會顯示button了,看了后面的例子就會明白)

同樣,選中PRoject navigator中的Nav文件夾,單擊鼠標右鍵,選擇“New File...”,在彈出的窗口中,左邊選擇Cocoa Touch,右邊選擇Objective-C class,點擊Next按鈕,在下一個窗口中將class命名為BIDRowControlsController,Subclass of命名為BIDSecondLevelViewController,點擊Next按鈕,完成創建。

打開BIDRowControlsController.h,添加如下代碼

復制代碼
#import "BIDSecondLevelViewController.h"@interface BIDRowControlsController : BIDSecondLevelViewController@property (strong, nonatomic) NSArray *list;- (IBAction)buttonTapped:(id)sender;@end
復制代碼

list用戶保存table view中每一行顯示的數據,buttonTapped事件用于按鈕的觸發,大家也可以猜到,會是一個警告框彈出。(嚴格的來說這里不指定IBAction也可以,因為我們并沒有創建nib,也不會拖一個button到nib上面然后與其關聯,定義一個普通的沒有返回值的方法即可,但是書里面還是推薦使用IBAction關鍵詞,這樣可以方面代碼的閱讀,可以知道這個方法是用于被某個控件觸發的。樓主木有試過這個方法,大家可以試試看,哈哈)

打開BIDRowControlsController.m,添加如下代碼

復制代碼
#import "BIDRowControlsController.h"@implementation BIDRowControlsController@synthesize list;- (IBAction)buttonTapped:(id)sender{    UIButton *senderButton = (UIButton *)sender;    UITableViewCell *buttonCell = (UITableViewCell *)[senderButton superview];    NSUInteger buttonRow = [[self.tableView indexPathForCell:buttonCell] row];    NSString *buttonTitle = [list objectAtIndex:buttonRow];    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"You tapped the button"                                                    message:[NSString stringWithFormat:@"You tapped the button for %@", buttonTitle]                                                   delegate:nil                                          cancelButtonTitle:@"OK"                                          otherButtonTitles:nil];    [alert show];}- (void)viewDidLoad {    [super viewDidLoad];    NSArray *array = [[NSArray alloc] initWithObjects:@"R2-D2",                      @"C3PO", @"Tik-Tok", @"Robby", @"Rosie", @"Uniblab",                      @"Bender", @"Marvin", @"Lt. Commander Data",                      @"Evil Brother Lore", @"Optimus Prime", @"Tobor", @"HAL",                      @"Orgasmatron", nil];    self.list = array;}- (void)viewDidUnload{    [super viewDidUnload];    self.list = nil;}
復制代碼

這里添加了很常見的viewDidLoad和viewDidUnload,并且實現了buttonTapped方法,稍微解釋一下buttonTapped方法:
UIButton *senderButton = (UIButton *)sender; // 根據sender參數來確定是哪個button觸發了該事件,然后根據button所在的
UITableViewCell *buttonCell = (UITableViewCell *)[senderButton superview]; // 獲得button的superview,因為該button是在某一個的table cell上,因此它的superview就是UITableViewCell,因此這里可以強制的將button的superview轉換成UITableViewCell對象
NSUInteger buttonRow = [[self.tableView indexPathForCell:buttonCell] row]; // 根據獲得的table cell得到indexPath,再根據indexPath獲得button具體在第幾行
NSString *buttonTitle = [list objectAtIndex:buttonRow]; // 有第幾行,就可以在list中找到對應的字符串了

接著添加table data source方法,添加如下代碼

復制代碼
#pragma mark -#pragma mark Table Data Source Methods- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{    return [list count];}- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{    static NSString *ControlRowIdentifier = @"ControlRowIdentifier";        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ControlRowIdentifier];    if(cell == nil) {        cell = [[UITableViewCell alloc]                initWithStyle:UITableViewCellStyleDefault                reuseIdentifier:ControlRowIdentifier];        UIImage *buttonUpImage = [UIImage imageNamed:@"button_up.png"];        UIImage *buttonDownImage = [UIImage imageNamed:@"button_down.png"];        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];        button.frame = CGRectMake(0.0, 0.0, buttonUpImage.size.width, buttonUpImage.size.height);        [button setBackgroundImage:buttonUpImage forState:UIControlStateNormal];        [button setBackgroundImage:buttonDownImage forState:UIControlStateHighlighted];        [button setTitle:@"Tap" forState:UIControlStateNormal];        [button addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside];        cell.accessoryView = button;    }    NSUInteger row = [indexPath row];    NSString *rowTitle = [list objectAtIndex:row];    cell.textLabel.text = rowTitle;        return cell;}
復制代碼

這2個方法也見了很多次了,對tableview:cellForRowAtIndexPath中的一些內容進行解釋:
UIImage *buttonUpImage = [UIImage imageNamed:@"button_up.png"]; // 載入button彈起狀態時的圖片
UIImage *buttonDownImage = [UIImage imageNamed:@"button_down.png"]; // 載入button按下時的圖片
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; // 創建一個button,這里沒有使用一般的創建方法[UIButton alloc],原因是如果使用了這樣的方法創建button,之中對這個button的外觀、文字等就不能進行修改了,因此我們使用buttonWithType,并選擇UIButtonTypeCustom,自定義button外觀
button.frame = CGRectMake(0.0, 0.0, buttonUpImage.size.width, buttonUpImage.size.height); // 定義button的大小
[button setBackgroundImage:buttonUpImage forState:UIControlStateNormal]; // 用一張圖片設置button彈起時的狀態
[button setBackgroundImage:buttonDownImage forState:UIControlStateHighlighted]; // 用另一張圖片設置button按下時的狀態
[button setTitle:@"Tap"forState:UIControlStateNormal]; // 設置button的文字
[button addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside]; // 為button添加事件,分2部分,首先是觸發哪個事件,另一個是在什么情況下觸發,這里設置的觸發的事件是buttonTapped(IBAction類型,這是為什么剛才說不適用IBAction關鍵詞也可以,因為我們使用代碼的方式為button制定了觸發的方法,因此不用IBAction),當手指在button內部彈起時才會觸發buttonTapped事件。
cell.accessoryView = button; // 在table cell的accessoryView的位置放置button

添加table的delegate方法,代碼如下

復制代碼
#pragma mark -#pragma mark Table Delegate Methods- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{    NSUInteger row = [indexPath row];    NSString *rowTitle = [list objectAtIndex:row];    UIAlertView *alert = [[UIAlertView alloc]                          initWithTitle:@"You tapped the row."                          message:[NSString stringWithFormat:@"You tapped %@.", rowTitle]                          delegate:nil                          cancelButtonTitle:@"OK"                          otherButtonTitles:nil];    [alert show];    [tableView deselectRowAtIndexPath:indexPath animated:YES];}
復制代碼

這個方法的實現之前也見過,就對最后一句話解釋一下:
[tableView deselectRowAtIndexPath:indexPath animated:YES]; // 當點擊table view中的一行時,該行的背景色會變藍,這句話的作用就是使其恢復成原來未選擇時的狀態

最后打開BIDFirstLevelController.m,添加如下代碼

復制代碼
#import "BIDFirstLevelController.h"#import "BIDSecondLevelViewController.h"#import "BIDDisclosureButtonController.h"#import "BIDCheckListController.h"#import "BIDRowControlsController.h"@implementation BIDFirstLevelController@synthesize controllers;- (void)viewDidLoad {    [super viewDidLoad];    self.title = @"First Level";    NSMutableArray *array = [[NSMutableArray alloc] init];        // Disclosure Button    BIDDisclosureButtonController *disclosureButtonController = [[BIDDisclosureButtonController alloc] initWithStyle:UITableViewStylePlain];    disclosureButtonController.title = @"Disclosure Buttons";    disclosureButtonController.rowImage = [UIImage imageNamed:@"disclosureButtonControllerIcon.png"];    [array addObject:disclosureButtonController];        // Checklist    BIDCheckListController *checkListController = [[BIDCheckListController alloc] initWithStyle:UITableViewStylePlain];    checkListController.title = @"Check One";    checkListController.rowImage = [UIImage imageNamed:@"checkmarkControllerIcon.png"];    [array addObject:checkListController];        // Row Controls    BIDRowControlsController *rowControlsController = [[BIDRowControlsController alloc] initWithStyle:UITableViewStylePlain];    rowControlsController.title = @"Row Controls";    rowControlsController.rowImage = [UIImage imageNamed:@"rowControlsIcon.png"];    [array addObject:rowControlsController];        self.controllers = array;}
復制代碼

這里就不解釋了,和之前的一樣。

編譯運行,效果如下

多了最下面的Row Controls,我們點擊改行


每一個cell都有一個我們剛才定義的button在上面

我們點擊button,顯示效果如下

我們點擊行,顯示效果如下

這個例子就如此簡單的完成了,我們接著下一個例子。

2)第四個subtableview:Movable Rows 
這個例子是用來說明如何移動table view中的每一行,可以對其重新進行排序,在table view中有一個現成的方法叫做setEditing:animated,用于設置table view的內容是否可以進行編輯(edit)、刪除(delete)、插入(insert),如果我們要對table view中的內容進行操作,我們必須設置其為true,否則table view是不能進行編輯的。這個例子中,我們將對table view中的行進行操作,因此一定要設置其為true。廢話不多說,看來下面的例子就會更加清楚,好,現在開始這個例子。

選中Project navigator中的Nav文件夾,單擊鼠標右鍵,選擇“New File...”,在彈出的窗口中,左邊選擇Cocoa Touch,右邊選擇Objective-C class,點擊Next按鈕,在下一個窗口中將class命名為BIDMoveMeController,Subclass of命名為BIDSecondLevelViewController,點擊Next按鈕,完成創建。

打開BIDMoveMeController.h,添加如下代碼

@interface BIDMoveMeController : BIDSecondLevelViewController@property (strong, nonatomic) NSMutableArray *list;- (IBAction)toggleMove;@end

list用于保存數據,這里聲明的類型是NSMutableArray,因為我們要對table view中的行進行移動,因此list的內容會發生變化,因此需要一個可變的Array。toggleMove方法用于打開/關閉table view的編輯模式。

打開BIDMoveMeController.m,添加如下代碼

復制代碼
#import "BIDMoveMeController.h"@implementation BIDMoveMeController@synthesize list;- (IBAction)toggleMove{    [self.tableView setEditing:!self.tableView.editing animated:YES];        if(self.tableView.editing)        [self.navigationItem.rightBarButtonItem setTitle:@"Done"];    else        [self.navigationItem.rightBarButtonItem setTitle:@"Move"];}- (void)viewDidLoad {    [super viewDidLoad];    if (list == nil) {        NSMutableArray *array = [[NSMutableArray alloc] initWithObjects:                                 @"Eeny", @"Meeny", @"Miney", @"Moe", @"Catch", @"A",                                 @"Tiger", @"By", @"The", @"Toe", nil];        self.list = array;    }        UIBarButtonItem *moveButton = [[UIBarButtonItem alloc]                                   initWithTitle:@"Move"                                   style:UIBarButtonItemStyleBordered                                   target:self                                   action:@selector(toggleMove)];    self.navigationItem.rightBarButtonItem = moveButton;}
復制代碼

先說一下toggleMove,這個方法是給navigator bar上右邊的按鈕調用的,
[self.tableView setEditing:!self.tableView.editing animated:YES]; // 通過self.tableView.editing屬性安排當前table view的狀態是不是處于編輯模式,如果是,則變回非編輯模式,如果不是,則進入編輯模式
if(self.tableView.editing// 如果是編輯模式
    [self.navigationItem.rightBarButtonItem setTitle:@"Done"]; // 設置navigator上右邊的按鈕文字為“Done”
else // 如果不是編輯模式
    [self.navigationItem.rightBarButtonItem setTitle:@"Move"]; // 設置navigator上右邊的按鈕文字為“Move”

在viewDidLoad方法中,我們創建了一個button(moveButton),然后將該button賦給navigator上右邊的按鈕。

大家有沒有注意到這里我們沒有定義viewDidUnload?我們在viewDidLoad中,也沒有每次都對list進行創建,而是判斷list是否為nil,如果是,則生成list。我們為什么要這么做呢?一個很重要的原因是之后我們將對list中的內容進行排序,如果每次都生成新的list,那么我們剛剛排好序的list就會丟失,這個是我們不希望發生的,因此我們在這里就不對list反復的進行創建了。

好,接著添加如下代碼

復制代碼
#pragma mark -#pragma mark Table Data Source Methods- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{    return [list count];}- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{    static NSString *MoveMeCellIdentifier = @"MoveMeCellIdentifier";    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MoveMeCellIdentifier];    if(cell == nil)    {        cell = [[UITableViewCell alloc]                initWithStyle:UITableViewCellStyleDefault                reuseIdentifier:MoveMeCellIdentifier];        cell.showsReorderControl = YES;    }    NSUInteger row = [indexPath row];    cell.textLabel.text = [list objectAtIndex:row];        return cell;}
復制代碼

在tableView:cellForRowAtIndexPath中,有一句新的代碼:
cell.showsReorderControl = YES; // 它的作用是顯示reorder的控件(重新排序的控件),比較奇怪的是我試過把這句話注釋掉,但是哪個排序控件依然出現,不知道為什么。

接著添加代碼

復制代碼
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{    return UITableViewCellEditingStyleNone;}- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath{    return YES;}- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath{    NSUInteger fromRow = [fromIndexPath row];    NSUInteger toRow = [toIndexPath row];        id object = [list objectAtIndex:fromRow];    [list removeObjectAtIndex:fromRow];    [list insertObject:object atIndex:toRow];}
復制代碼

上面3個方法都是第一次看見,第一個方法tableView:editingStyleForRowAtIndexPath用于制定tableview是否可以進行刪除或者插入操作,在這里我們僅僅是進行排序,所以返回的對象是UITableViewCellEditingStyleNone。第二個方法tableView:canMoveRowAtIndexPath,指定是否可以移動行。最后一個方法tableView:moveRowAtIndexPath是移動行后進行操作的方法,記錄一行的起始位置和終點,然后在list中把先備份一下起始位置的值,然后刪除,最后再終點位置插入備份值,ok,完成移動操作。怎么樣,還是很直接和簡單的吧。

打開BIDFirstLevelController.m,添加最后的代碼

復制代碼
#import "BIDFirstLevelController.h"#import "BIDSecondLevelViewController.h"#import "BIDDisclosureButtonController.h"#import "BIDCheckListController.h"#import "BIDRowControlsController.h"#import "BIDMoveMeController.h"@implementation BIDFirstLevelController@synthesize controllers;- (void)viewDidLoad {    [super viewDidLoad];    self.title = @"First Level";    NSMutableArray *array = [[NSMutableArray alloc] init];        // Disclosure Button    BIDDisclosureButtonController *disclosureButtonController = [[BIDDisclosureButtonController alloc] initWithStyle:UITableViewStylePlain];    disclosureButtonController.title = @"Disclosure Buttons";    disclosureButtonController.rowImage = [UIImage imageNamed:@"disclosureButtonControllerIcon.png"];    [array addObject:disclosureButtonController];        // Checklist    BIDCheckListController *checkListController = [[BIDCheckListController alloc] initWithStyle:UITableViewStylePlain];    checkListController.title = @"Check One";    checkListController.rowImage = [UIImage imageNamed:@"checkmarkControllerIcon.png"];    [array addObject:checkListController];        // Row Controls    BIDRowControlsController *rowControlsController = [[BIDRowControlsController alloc] initWithStyle:UITableViewStylePlain];    rowControlsController.title = @"Row Controls";    rowControlsController.rowImage = [UIImage imageNamed:@"rowControlsIcon.png"];    [array addObject:rowControlsController];        // Move Me    BIDMoveMeController *moveMeController = [[BIDMoveMeController alloc] initWithStyle:UITableViewStylePlain];    moveMeController.title = @"Move Me";    moveMeController.rowImage = [UIImage imageNamed:@"moveMeIcon.png"];    [array addObject:moveMeController];        self.controllers = array;}
復制代碼

編譯運行

進入Move Me后

點擊navigator上右邊的Move按鈕

按鈕的文字變成了“Done”,然后tableview中每一行的右邊都出現了一個reorder的圖標,將手指放在上面逗留一會,你點中的那一行會“浮起”,接著你就可以隨意移動了,移到你想要的地方后放手即可。

3)第五個subtableview:Deletable Rows 
這個例子展示的是如何刪除table view中的行,這次我們不再在viewDidLoad中對table view的內容進行定義,而是從外部的一個文件進行導入,首先下載這里的computers.plist.zip,解壓縮后拖入到Project navigator下的Nav文件夾下

好,下面可以開始添加新的文件了,選中Project navigator中的Nav文件夾,單擊鼠標右鍵,選擇“New File...”,在彈出的窗口中,左邊選擇Cocoa Touch,右邊選擇Objective-C class,點擊Next按鈕,在下一個窗口中將class命名為BIDDeleteMeController,Subclass of命名為BIDSecondLevelViewController,點擊Next按鈕,完成創建。

打開BIDDeleteMeController.h文件,添加如下代碼

復制代碼
#import "BIDSecondLevelViewController.h"@interface BIDDeleteMeController : BIDSecondLevelViewController@property (strong, nonatomic) NSMutableArray *list;- (IBAction)toggleEdit:(id)sender;@end
復制代碼

應該可以想到,我們肯定要聲明一個NSMutableArray,因為需要刪除其中的項,toggleEdit方法用于table view狀態的切換。

打開BIDDeleteMeController.m文件,添加如下代碼

復制代碼
#import "BIDDeleteMeController.h"@implementation BIDDeleteMeController@synthesize list;- (IBAction)toggleEdit:(id)sender{    [self.tableView setEditing:!self.tableView.editing animated:YES];        if(self.tableView.editing)        [self.navigationItem.rightBarButtonItem setTitle:@"Done"];    else        [self.navigationItem.rightBarButtonItem setTitle:@"Delete"];}- (void)viewDidLoad{    [super viewDidLoad];    if(list == nil)    {        NSString *path = [[NSBundle mainBundle] pathForResource:@"computers" ofType:@"plist"];        NSMutableArray *array = [[NSMutableArray alloc] initWithContentsOfFile:path];        self.list = array;    }    UIBarButtonItem *editButton = [[UIBarButtonItem alloc]                                   initWithTitle:@"Delete"                                   style:UIBarButtonItemStyleDone                                   target:self                                   action:@selector(toggleEdit:)];    self.navigationItem.rightBarButtonItem = editButton;}
復制代碼

應該不會覺得有看不懂的地方吧,和之前的一個例子是一樣的,那么就接著添加代碼吧

復制代碼
#pragma mark -#pragma mark Table Data Source Methods- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{    return [list count];}- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{    static NSString *DeleteMeCellIdentifier = @"DeleteMeCellIdentifier";        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:DeleteMeCellIdentifier];        if(cell == nil)    {        cell = [[UITableViewCell alloc]                initWithStyle:UITableViewCellStyleDefault                reuseIdentifier:DeleteMeCellIdentifier];    }        NSInteger row = [indexPath row];    cell.textLabel.text = [list objectAtIndex:row];    return cell;}
復制代碼

額~~~貌似也不用解釋,好吧,就不解釋了,繼續添加代碼

復制代碼
#pragma mark -#pragma mark Table View Data Source Methods- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{    NSUInteger row = [indexPath row];    [self.list removeObjectAtIndex:row];    [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]                     withRowAnimation:UITableViewRowAnimationAutomatic];}
復制代碼

這是一個新的方法,第一次使用,當用戶要刪除table view中的一行或者進行插入操作時,會觸發該方法。其中第二個參數有三個值,分別是:
UITableViewCellEditingStyleNone:什么操作都不執行(這個值在上一個例子中使用過)
UITableViewCellEditingStyleDelete:刪除操作
UITableViewCellEditingStyleInsert:插入操作

這個方法里面的具體代碼還是很好理解的,都不多做解釋了。

打開BIDFirstLevelController.m,添加最后的代碼

復制代碼
#import "BIDFirstLevelController.h"#import "BIDSecondLevelViewController.h"#import "BIDDisclosureButtonController.h"#import "BIDCheckListController.h"#import "BIDRowControlsController.h"#import "BIDMoveMeController.h"#import "BIDDeleteMeController.h"@implementation BIDFirstLevelController@synthesize controllers;- (void)viewDidLoad {    [super viewDidLoad];    self.title = @"First Level";    NSMutableArray *array = [[NSMutableArray alloc] init];        // Disclosure Button    BIDDisclosureButtonController *disclosureButtonController = [[BIDDisclosureButtonController alloc] initWithStyle:UITableViewStylePlain];    disclosureButtonController.title = @"Disclosure Buttons";    disclosureButtonController.rowImage = [UIImage imageNamed:@"disclosureButtonControllerIcon.png"];    [array addObject:disclosureButtonController];        // Checklist    BIDCheckListController *checkListController = [[BIDCheckListController alloc] initWithStyle:UITableViewStylePlain];    checkListController.title = @"Check One";    checkListController.rowImage = [UIImage imageNamed:@"checkmarkControllerIcon.png"];    [array addObject:checkListController];        // Row Controls    BIDRowControlsController *rowControlsController = [[BIDRowControlsController alloc] initWithStyle:UITableViewStylePlain];    rowControlsController.title = @"Row Controls";    rowControlsController.rowImage = [UIImage imageNamed:@"rowControlsIcon.png"];    [array addObject:rowControlsController];        // Move Me    BIDMoveMeController *moveMeController = [[BIDMoveMeController alloc] initWithStyle:UITableViewStylePlain];    moveMeController.title = @"Move Me";    moveMeController.rowImage = [UIImage imageNamed:@"moveMeIcon.png"];    [array addObject:moveMeController];        // Delete Me    BIDDeleteMeController *deleteMeController = [[BIDDeleteMeController alloc] initWithStyle:UITableViewStylePlain];    deleteMeController.title = @"Delete Me";    deleteMeController.rowImage = [UIImage imageNamed:@"deleteMeIcon.png"];    [array addObject:deleteMeController];        self.controllers = array;}
復制代碼

編譯運行

選擇Delete Me進入

點擊右上角的Delete按鈕

點擊左邊的紅圈,出現刪除按鈕

點擊Delete按鈕,刪除改行

再次點擊右上角的Done,還原

另外一種產用的刪除方法,直接在某一行上劃一下,出現Delete按鈕,刪除

4)總結
好了,這篇三個例子的講解就到此為止,對table view各個方面的屬性進行說明,都是一些很常見的操作,以后在開發app的時候也一定會使用到這些常用的功能。希望各位能夠看懂,也再次感謝給我留言的每一位朋友,你們是我繼續寫下去的動力!


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
欧美大片大片在线播放| 亚洲人成网站999久久久综合| 久久亚洲精品小早川怜子66| 欧美激情在线狂野欧美精品| 国产精品久久久久久久久久久久| 在线观看视频99| 欧美午夜精品伦理| 欧美成人自拍视频| 日本精品视频在线观看| 色爱精品视频一区| 国产美女精品免费电影| 国产精品美女www爽爽爽视频| 日韩中文字幕网址| 欧美久久精品一级黑人c片| 成人h片在线播放免费网站| 91在线视频成人| 日韩二区三区在线| 亚洲精品一区久久久久久| 欧美视频在线视频| 欧美精品在线看| 国产在线播放不卡| 91在线观看欧美日韩| 欧美激情综合亚洲一二区| 91精品久久久久久久久青青| 久久影院中文字幕| 亚洲国产精品视频在线观看| 亚洲福利小视频| 亚洲自拍偷拍第一页| 亚洲最大在线视频| 欧美日韩另类字幕中文| 成人网欧美在线视频| 欧美理论在线观看| 亚洲欧洲国产伦综合| 深夜福利国产精品| 国产91精品久久久久| 午夜精品久久久久久99热| 一区二区三区四区在线观看视频| 日韩中文在线视频| 成人性生交大片免费看小说| 91人成网站www| 欧美日韩成人精品| 国产精品永久在线| 黄色一区二区在线观看| 日韩美女av在线| 欧美日韩国产综合视频在线观看中文| 中文在线资源观看视频网站免费不卡| 亚洲综合大片69999| 国产精品视频区| 欧美成人精品不卡视频在线观看| 国产精品第8页| 国产精品香蕉av| 色哟哟网站入口亚洲精品| 欧美色videos| 麻豆成人在线看| 久久在线免费视频| 搡老女人一区二区三区视频tv| 国产精品男女猛烈高潮激情| 91精品久久久久久久久久入口| 欧美午夜精品久久久久久久| 亚洲欧美一区二区三区在线| 日韩电影免费在线观看中文字幕| 欧美成人免费一级人片100| 国产精品午夜视频| 96精品久久久久中文字幕| 欧美最猛性xxxxx(亚洲精品)| 亚洲激情视频在线观看| 国产97在线|亚洲| 深夜福利日韩在线看| 成人国产精品一区| 欧美日韩亚洲高清| 黄色成人在线免费| 久久人人爽人人爽爽久久| 91精品国产综合久久久久久久久| 国产自产女人91一区在线观看| 亚洲精品国产精品久久清纯直播| 国产精品9999| 中文在线资源观看视频网站免费不卡| 成人淫片在线看| 国内精品久久久久影院 日本资源| 日韩电视剧免费观看网站| 欧美裸体男粗大视频在线观看| 亚洲福利在线观看| 日韩高清有码在线| 97碰碰碰免费色视频| 亚洲一区二区日本| 热99精品里视频精品| 丝袜情趣国产精品| 欧美午夜片欧美片在线观看| 成人啪啪免费看| 午夜剧场成人观在线视频免费观看| 亚洲色图校园春色| 国产精品久久久久免费a∨| 亚洲一区二区三区成人在线视频精品| 久久久精品2019中文字幕神马| 日韩av不卡电影| 国产精品国产自产拍高清av水多| 国产精品视频久| 久久av红桃一区二区小说| 亚洲另类欧美自拍| 亚洲免费视频一区二区| 欧美精品激情视频| 黄色成人av网| 欧美激情极品视频| 日韩精品免费看| 国产精品成人久久久久| 午夜剧场成人观在线视频免费观看| 亚洲欧美在线播放| 91嫩草在线视频| 5566成人精品视频免费| 国产精品日韩一区| 精品福利樱桃av导航| 成人国内精品久久久久一区| 色99之美女主播在线视频| 亚洲电影在线观看| 欧美激情免费观看| 美女国内精品自产拍在线播放| 欧美巨乳美女视频| 久久久久久国产三级电影| 久久国产视频网站| 久久久久久久久久久久av| 日韩在线观看视频免费| 成人中文字幕在线观看| 日韩a**站在线观看| 欧美一区深夜视频| 欧美国产日韩一区二区| 日韩欧美精品网站| 一区二区国产精品视频| 日韩精品福利网站| 久久久久久久久中文字幕| 日韩一区二区福利| 日韩av免费在线看| 久久精品国产久精国产一老狼| 亚洲欧美三级伦理| 色妞欧美日韩在线| 福利二区91精品bt7086| 国产亚洲精品91在线| 久久天堂av综合合色| 久久成年人免费电影| 成人欧美一区二区三区黑人孕妇| 国产精品第3页| 久久99热这里只有精品国产| 久久99视频精品| 夜夜嗨av一区二区三区四区| 国产精品久久久久久久久男| 国产精品免费视频xxxx| 91精品久久久久久久久中文字幕| 伊人成人开心激情综合网| 青青草原一区二区| 亚洲欧洲日产国码av系列天堂| www高清在线视频日韩欧美| 欧美日韩一区免费| 国产午夜精品视频免费不卡69堂| 69**夜色精品国产69乱| 按摩亚洲人久久| 久久91精品国产91久久久| 欧美成人性色生活仑片| 欧美黑人狂野猛交老妇| 在线观看国产成人av片| 日韩精品极品在线观看播放免费视频| 欧美尤物巨大精品爽| 欧美精品在线免费| 日韩精品视频在线免费观看| 亚洲天堂色网站| 日韩免费观看在线观看|