I hope heroes pointing pointing twelve, it is best to paste the code, hey, I am very grateful! Just learning iphone, a fog, sweat!
You can also send to my mailbox: evan_lynn@163.com again thanks!
Reply:
Did not get off, new to IPHONE, would like to know. Bangding.
Reply:
iPhone UITableView (use UITableView smooth squared effect )
UITableView is a "catalog view or table view called" (English name table view), this table is displayed in a list view or edit the information, which consists of a column, multiple rows. Users can navigate through the vertical scroll all the way to an arbitrary row of the table view, and you can customize the display of data in each row.
When you create a table view, you can choose between two styles of table view: UITableViewStylePlain or UITableViewStyleGrouped, the former is sorted according to the index, while the latter is based on group classification display.
Basically, each one has a corresponding UITableView UITableViewController, UITableViewDelegate, UITableViewDataSource class. UITableViewController class as a class UITableView view control (MVC Controller in the role) is responsible for managing UITableView, it most UIViewController class, controls the life cycle of a function UITableView. UITableViewDelegate commissioned as an interface mode is the delegate object, and most of the iPhone commissioned interfaces, it provides a UITableView subclass can not be consistent in behavior section, where readers can customize the display style table view, or even self- Each element defines a table view, it's important interfaces are defined as follows:
@ Protocol UITableViewDelegate
@ Optional
/ / Display customization
- (Void) tableView: (UITableView *) tableView willDisplayCell: (UITableViewCell *) cell forRowAtIndexPath: (NSIndexPath *) indexPath;
/ / Variable height support
- (CGFloat) tableView: (UITableView *) tableView heightForRowAtIndexPath: (NSIndexPath *) indexPath;
- (CGFloat) tableView: (UITableView *) tableView heightForHeaderInSection: (NSInteger) section;
- (CGFloat) tableView: (UITableView *) tableView heightForFooterInSection: (NSInteger) section;
/ / Section header & footer information. Views are preferred over title should you decide to provide both
- (UIView *) tableView: (UITableView *) tableView viewForHeaderInSection: (NSInteger) section;
- (UIView *) tableView: (UITableView *) tableView viewForFooterInSection: (NSInteger) section;
/ / Accessories (disclosures).
- (Void) tableView: (UITableView *) tableView accessoryButtonTappedForRowWithIndexPath: (NSIndexPath *) indexPath;
/ / Selection
/ / Called before the user changes the selection. Return a new indexPath, or nil, to change the proposed selection.
- (NSIndexPath *) tableView: (UITableView *) tableView willSelectRowAtIndexPath: (NSIndexPath *) indexPath;
/ / Called after the user changes the selection.
- (Void) tableView: (UITableView *) tableView didSelectRowAtIndexPath: (NSIndexPath *) indexPath;
/ / Editing
- (UITableViewCellEditingStyle) tableView: (UITableView *) tableView editingStyleForRowAtIndexPath: (NSIndexPath *) indexPath;
/ / Indentation
- (NSInteger) tableView: (UITableView *) tableViewindentationLevelForRowAtIndexPath: (NSIndexPath *) indexPath; / / return'depth 'of row for hierarchies
@ End
UITableViewDataSource provides a data source table view, the table below lists common table view data source methods:
Method
Description
tableView: numberOfRowsInSection:
Rows
in particular Section
numberOfSectionsInTableView:
Section number
particular data source table view
tableView: cellForRowAtIndexPath:
Get cell contents from the data source and place on a particular line
sectionIndexTitlesForTableView:
Title
get a table view of data sources
tableView: commitEditingStyle: forRowAtIndexPath
Submit cell content changes
talbeView: canEditRowAtIndexPath:
By returning a Boolean to notify the table view can modify a row
tableView: canMoveRowAtIndexPath:
By returning a Boolean to notify the table view can be moved
a row
tableView: moveRowAtIndexPath: toIndexPath:
Allows one table view cell is moved
Table view data source interface provides a common method of operation of the data source table view, which tableView: numberOfRowsInSection and tableView: cellForRowAtIndexPath: two methods for each data source table trying to be achieved, the former tells how many rows of cells within a table view , which tells the table view of what each cell is. Program through the realization of these two methods can provide basic information needed for a table view and table view is called for.
In the following example I will write a table view with navigation panel, this complex type of control can be seen everywhere in the iPhone, such as iPod procedures, memos program, alarm procedures.
ü First, create a "Window-based" project named "TableProjectOne".
ü Create a UIViewController subclass, and named "MyViewController".
ü create an empty xib named "MyViewController".
ü Open MyViewController.xib in Interface Build in.
ü drag from the Library in a view to MyViewController window, and then add a table view to the newly added view, table view to ensure complete filling view.
ü Modify File's Owner to MyViewController, connection MyViewController of view newly added to the above view.
ü here MyViewController created, save and exit Interface Build.
ü Open MainWindow.xib and drag a Navigation Controller to the window.
ü drag a View Controller to the Navigation Controller, change the class name and Nib named MyViewController.
ü Drag a Bar Button Item onto the Navigation Controller, and change the title to "view2".
Modify TableProjectOneAppDelegate.h file as follows:
# Import
# Import "MyViewController.h"
@ Interface TableProjectOneAppDelegate: NSObject
UIWindow * window;
IBOutlet UINavigationController * viewController;
}
@ Property (nonatomic, retain) IBOutlet UIWindow * window;
@ Property (nonatomic, retain) IBOutlet UINavigationController * viewController;
@ End
Implementation file TableProjectOneAppDelegate.m follows:
# Import "TableProjectOneAppDelegate.h"
@ Implementation TableProjectOneAppDelegate
@ Synthesize window;
@ Synthesize viewController;
- (Void) applicationDidFinishLaunching: (UIApplication *) application {
[Window addSubview: self.viewController.view];
/ / Override point for customization after application launch
[Window makeKeyAndVisible];
}
- (Void) dealloc {
[Window release];
[ViewController release];
[Super dealloc];
}
@ End
Reply:
http://madhome.org/simple/?t1145.html
Reply:
The easiest and quickest way to a view on the plus 9 button on it.
Is the case of a main menu, a practice fast and efficient.
Reply:
Plus button directly tried, hey, but when the phone is rotated, the view is not very nice, but thank you!
UITableView I have tried, but just learning this, failing to make use of these methods, drawn three rows of squares in fact, I click, then select a line, it will be one of the three grids to select it, and the interface is does not look good! Can be affixed to a realistic squared code? Hehe
Reply:
When rotating screen location A dynamic control buttons.
Or directly design two view, horizontal and vertical screen display designed separately.
Common background processing.
Reply:
How common background processing should achieve it?
Reply:
Qim direct approach adopted to solve the sweat! But with UITableView not yet been solved, depressed, thank you!
Reply:
Can be achieved using a UITableView
No comments:
Post a Comment