把新的mvc推送到屏幕上
另一个则滑出
它仍然存在, 左侧的MVC还在
只是不在屏幕上而忆, 另外一个mvc
那有个小按钮
后退按钮
导航控制器
就会将其撤消
返回有一个强指针指向
管理好内存
不希望保存这个图
你可以重新创建它
只要再点,就会重新创建这个MVC
UITabBarController
Another "controller of controllers"
Mostly set up with ctrl-drag jus like split vew or naviagtion controller
UINavigationItem
in-lining blocks of code
Fundation of multi=threaded support
block is a language feature
不使用多线程,就做不了复杂的应用
UI线程能够持续的对用户做出应答
Blocks
如何设置segues
look at how we create a UINavigationController in our storyboard
触发segues 把它嵌进这个导舫 控制器
ctrl+ drag
segues 总是创建一个新的
mvc没有了。
UINavigatonController
UIView abtained from the view propertity of the UIViewController most recently pushed
toolbarItems UIBarButton 组成的NSArray
什么时候退出呢
popViewControllerAnimated
在程序里把它弹出去
[self.navigationController popViewControllerAnimated:YES];
self.popoverConroller
replace
在拆分的视图控制器里
popovers 型的针对ipad而言
模式表达可能被滥用
模式下的用户体验是比较挫折的
如何在代码里触发segue呢
心理学游戏
而是用一个target action
UITabBarController
Tab Bar Controller view Controller
you control drag to create theae connection s is Code.
badges
tabeBarItem\
the types and styles of table views
the anatomy and diemsions of table views
UITableView's relationship to the UIScrollView superclass
creation of table views in code and with IB
use of the UITableViewController class to tabke
advantage of its template methods
Understanding Table Views
a list of items that can e scrolled vertically.
this is a common interface design pattern
UIKit provides a powerful suit of clases and protocols to
make the creation and management of table views
as simple and as effective as possible.
range from a very plain list created by using one
of the standard styles provided by the SDK
The Contacts app is an example of an indexed table
with section headings.
grouped static rows again with section headers.
tabkes the table view customization to wxtremes
two sections,
UITableViews and have identical interaction patterns
Working with the UITableView Family
the heart of the table view are classes protocols,
and view objects that make up the members of
UITableView family.
UITableView UITableViewController
UITableViewDelegate UITableViewDataSource protols
UITableView and UITableViewCell view objects
the classes provide the core functionality for the
table view ,the protocols define various data and interaction methods
and the view objects provide the physical user interface.
The UITableView Class Hierarchy
a subclass of UIScrollView.which in turn inherits from UIView,
UIResponder, and ultimately NSObject,
UIScrollView provides the scrolling of the table, while UIResponder allows
the talbe cells to respond to user touches and swipes.
Choosing the Type of Table View.
two basic forms plain and grouped.
have two variations indexed and sectioned
The Plain Table
is the basic vanilia incarnation of the UITableView.
UITableView *tableView = [[UITableView alloc]initWithFrame:tvFrame style:UITableViewStylePlain];
The Indexed Table
builds on the plain table by adding an extra navigation aid in the form of an
index that appears on the right- hand side of the table view,adjacent
to the scroll area.
Implementing indexes involves UITableViewDataSource protocol methods,
and is covered in detail in Chapter 6.
The Sectioned Table
as its name suggests, groups its rows into sections.
These sections can have headers.
This type of table view utilises several UITableViewDataSource protols
methods to configure the behavior of the sections and is covered in.
The Grouped Table
things one step further by separating the sections into a style
that is distinct form the table view's background
each section has a header and footer.
Thease are Views , and are returned by two UITableViewDelegate methods
-(UIView *)tableView:tableView viewForFooterInSection:(NSInteger)section;
-(UIView *)tableView:tableView viewForHeaderInSection:(NSInteger)section;
-(NSString *)tableView:tableView titleForHeaderInSection:(NSInteger)section;
find the dimensions of the headers and footers,
-(CGRect)rectForHeaderInSection:(NSInteger)section;
-(CGRect)rectForFooterInSection:(NSInteger)section;
-(CGRect)rectForSection:(NSInteger)setion;
setting TableView Dimensions
think of it as a window that provides a view of a conveyor belt of cells.
indicated by the tableView's frame property.
the height of the tableView in pixels is available through the contentSize
property, which returns a CGFloat.
at the top and bottom of each belt of cells, you can add a UIView as a static header and footer.
tableHeaderView and tableFooterView
UIView *tableHeaderView = [[UIView alloc]initWithFrame:CGRectMake(0,0,320,50)];
[tableHeaderView setBackgroundColor:[UIColor blueColor]];
UIView *tableFooterView = [[UIView alloc]initWithFrame:CGRectMake(0,0,320,50)];
[tableFooterView setBackgroundColor:[UIColor blueColor]];
UILabel *headerLabel = [[UILabel alloc] initWithFrame:CGRectMake(10,10,320,25)];
headerLabel.text = @"Header View";
headerLabel.textColor = [UIColor whiteColor];
headerLabel.font = [UIFont boldSystemFornOfSize:22];
headerLabel.backgroundColor = [UIColor clearColor];
UILabel * footerLabel = [[UILabel alloc]initWithFrame:CGRectMake(10,10,320,25)];
footerLabel.text = @"Footer view";
footerLabel.textColor = [UIColor whiteColor];
footerLabel.font = [UIFont boldSystemFontOfSize:22];
footerLabel.backgroundColor = [UIColor clearColor];
[tableHeaderView addSubview:headerLabel];
[tableFooterView addSubView:footerLabel];
[self.tableView setTableHeaderView:tableHeaderVIew];
[self.tableView setTableFooterView:tableFooterView];
controlling the Background of a UITableView
Setting an image as the background of a UITableView
set the backgroundColor property of your tableView to clearColor
so that the background image is visible
What UITableView Inherits from UIScrollView
Everything that UITableView doesn't explicityly override
contentSize indicates the full height that the table
would be if all rows were created and populated at noce
contentOffset
scrollViewWillBeginDraging is fired just befoe the tableView starts moving
scrolViewDidScroll is called was stopped.
table views can only scroll vertically
Creating UITableViews
Placing a UITableView into Another View