UI pull-down refresh (IOS development) and ui pull-down ios development
Table applications have two uidesign modes: Paging mode and pull-down refresh mode.
Pull-down refresh is widely used (Sina Weibo, QQ)
Here, I spoke about QQ ink. In fact, PC desktop applications are good and flat in a timely manner. However, IOS 8 is a big market, but now it's all about IOS 8. Why is it still using the IOS 6 pull-down to refresh the "rubber sugar" UI style.
After IOS6, a drop-down refresh class of UIRefreshControl is added. Currently, this class can only be applied to the table View Interface.
In Xcode6, no drop-down or drag-down controls have been added to the story version, such as labels. Therefore, you don't have to worry too much about layout.
The code is reusable and can be used as a library.
H file:
#import <UIKit/UIKit.h>@interface TableViewController : UITableViewController@property (nonatomic, strong) NSMutableArray * Logs;@end
M file:
# Import "ViewController. h "@ interface TableViewController () @ end @ implementation TableViewController-(void) viewDidLoad {[super viewDidLoad]; // initialize the variable and time self. logs = [[NSMutableArray alloc] init]; NSDate * date = [[NSDate alloc] init]; [self. logs addObject: date]; // initialize UIRefreshControl // rc as a pointer to the control and can only be used on the table View Interface. // you do not need to consider layout issues, about UITableViewController, it will be automatically placed in the table view UIRefreshControl * rc = [[UIRefreshControl alloc] init]; rc. attributedTitle = [[NSAttributedString alloc] initWithString: @ "pull-down refresh"]; // check the spelling in selector [rc addTarget: self action: @ selector (refreshTableView) forControlEvents: UIControlEventValueChanged]; self. refreshControl = rc;}-(void) didReceiveMemoryWarning {[super didreceivemorywarning]; // Dispose of any resources that can be recreated .} -(void) refreshTableView {if (self. refreshControl. refreshing) {// determines whether the refresh status is self. refreshControl. attributedTitle = [[NSAttributedString alloc] initWithString: @ "loading... "]; // Add a new simulator NSDate * date = [[NSDate alloc] init]; // After the simulated request is complete, the callback method callBackMethod [self defined mselector: @ selector (callBackMethod :) withObject: date afterDelay: 3] ;}}-(void) callBackMethod :( id) obj {[self. refreshControl endRefreshing]; // stop the pull-down refresh control and return to the initial state self. refreshControl. attributedTitle = [[NSAttributedString alloc] initWithString: @ "pull-down refresh"]; // The text is changed back to [self. logs addObject :( NSDate *) obj]; [self. tableView reloadData] ;}# pragma mark --- UITableViewDataSource code-(NSInteger) preview :( UITableView *) tableView {return 1 ;}- (NSInteger) tableView :( UITableView *) tableView numberOfRowsInSection :( NSInteger) section {return [self. logs count];}-(UITableViewCell *) tableView :( UITableView *) tableView cellForRowAtIndexPath :( NSIndexPath *) indexPath {// This is the most important part of the Cell code segment. // define the Cell, then determine whether cellIdentifier reuse static NSString * CellIdentifier = @ "Cell"; UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier: CellIdentifier]; if (cell = nil) {cell = [[UITableViewCell alloc] initWithStyle: Invalid reuseIdentifier: CellIdentifier];} // then obtain the time NSDateFormatter * dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setDateFormat: @ "yyyy-MM-dd HH: mm: ss"]; // then update the cell. textLabel. text = [dateFormat stringFromDate: [self. logs objectAtIndex: [indexPath row]; cell. accessoryType = UITableViewCellAccessoryDisclosureIndicator; return cell;} @ end
Note that @ selector () does not check spelling, so make sure the spelling is correct!
UIPickerView (iOS development)
Dictionary, key, and value. The specific implementation, you think, can only provide you with ideas.
In Ios development, how does one smoothly load more chat records from the drop-down menu like the chat interface? Instead of simply reload, re
Fighting is a pass for success, while beauty is a grave for failure. Don't worry about your appearance. The key is to build your own strong heart. Friend, Feng Jie is an example. You are more inspirational than her. You can do it!