亚洲香蕉成人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
精品国内产的精品视频在线观看| 91在线视频成人| 国产在线观看精品一区二区三区| 亚洲精品视频播放| 欧美在线视频导航| 久久久久久久久久婷婷| 成人精品aaaa网站| 国产精品网站视频| 国产精品尤物福利片在线观看| 欧美最猛性xxxxx免费| 国产成人精品av| 国产高清在线不卡| 国产va免费精品高清在线观看| 大伊人狠狠躁夜夜躁av一区| 亚洲美女av在线| 久久综合亚洲社区| 亚洲人成电影网站色| 亚洲va欧美va国产综合剧情| 人人澡人人澡人人看欧美| 欧美视频在线视频| 在线精品视频视频中文字幕| 亚洲欧美国产另类| 日韩成人在线视频网站| 久久电影一区二区| 日韩欧美中文字幕在线播放| 国产精品久久久久久五月尺| 日本精品久久久| 中文字幕av一区中文字幕天堂| 亚洲色图五月天| 成人免费网站在线| 97在线日本国产| 国产精品自产拍在线观| 68精品国产免费久久久久久婷婷| 国产精品免费视频xxxx| 国自产精品手机在线观看视频| 久久久www成人免费精品| 国产日本欧美一区二区三区在线| 欧美在线亚洲在线| 热久久免费国产视频| 91精品国产自产在线老师啪| 欧美黄色片在线观看| 亚洲人午夜色婷婷| 亚洲色图综合网| 欧美大秀在线观看| 久久99久久99精品免观看粉嫩| 亚洲精品小视频在线观看| 国产精品91在线观看| 久国内精品在线| 久久青草福利网站| 538国产精品视频一区二区| 久久精品国产亚洲7777| 国产精品揄拍一区二区| 亚洲欧洲国产伦综合| 亚洲精品免费在线视频| 91精品国产高清久久久久久| 国产成人精彩在线视频九色| 亚洲第一男人av| 97免费中文视频在线观看| 国产成人a亚洲精品| 91国产精品91| 亚洲黄色av女优在线观看| 91网在线免费观看| 欧美激情综合色综合啪啪五月| 清纯唯美日韩制服另类| 一区二区三区视频免费在线观看| 日韩电影免费在线观看中文字幕| 一区二区欧美日韩视频| 91中文在线观看| 日韩一级黄色av| 欧美一区二区大胆人体摄影专业网站| 亚洲精品天天看| 亚洲国产精品视频在线观看| 精品亚洲永久免费精品| 欧美亚洲成人免费| 亚洲人成在线电影| 日韩中文字幕不卡视频| 欧美精品激情在线| 日韩精品在线观看一区二区| 亚洲韩国日本中文字幕| 亚洲福利在线看| 亚洲精品中文字| 国产狼人综合免费视频| 亚洲天堂男人天堂女人天堂| 国产精自产拍久久久久久蜜| 国产欧美日韩中文字幕在线| 日韩在线免费av| 久久99久国产精品黄毛片入口| 亚洲理论片在线观看| 97人人模人人爽人人喊中文字| 国产亚洲精品一区二区| 亚洲精选中文字幕| 麻豆成人在线看| 日韩乱码在线视频| 欧美精品免费看| 国产日产亚洲精品| 久久综合电影一区| 亚洲成人黄色在线| 欧美电影在线免费观看网站| 久久中文字幕国产| 91理论片午午论夜理片久久| 日韩av在线免费播放| 国产视频丨精品|在线观看| 日本久久久久久久| 亚洲淫片在线视频| 日韩www在线| 欧美日本啪啪无遮挡网站| 久久国产精品久久久久久| 国产a∨精品一区二区三区不卡| 一区二区欧美亚洲| 国语自产在线不卡| 亚洲精品电影久久久| 久久福利视频导航| 国产亚洲欧洲高清一区| 欧美性少妇18aaaa视频| 国产精品成av人在线视午夜片| 性色av一区二区三区免费| 欧美精品在线视频观看| 国产精品久久久久久久久久久久久久| 97国产suv精品一区二区62| 国自产精品手机在线观看视频| 精品视频在线导航| 久久久视频在线| 国产精品高清在线| 97视频免费看| 欧美黑人性猛交| 亚洲缚视频在线观看| 国产精品自拍网| 欧美日韩国产在线看| 亚洲国产小视频在线观看| 一二美女精品欧洲| 久久久久久久电影一区| 日韩精品中文字幕在线| 色哟哟亚洲精品一区二区| 美女精品视频一区| 国产热re99久久6国产精品| 麻豆一区二区在线观看| 成人免费看吃奶视频网站| 欧美中文字幕第一页| 国产精品高清网站| 亚洲第一区第一页| 日韩精品久久久久久福利| 97av在线视频| 国产精品日日摸夜夜添夜夜av| 2020国产精品视频| 色综合导航网站| 中文字幕不卡av| 国产99久久精品一区二区 夜夜躁日日躁| 国产精品网址在线| 亚洲成人动漫在线播放| 亚洲free性xxxx护士白浆| 久精品免费视频| 2023亚洲男人天堂| 久久视频中文字幕| 亚洲在线免费看| 在线日韩中文字幕| 伊人久久精品视频| 91探花福利精品国产自产在线| 欧美日韩成人在线观看| 国内精品久久久久久久久| 欧美亚洲激情视频| 亚洲美女视频网| 色爱精品视频一区| 色与欲影视天天看综合网| 91国产精品电影|