How to display the large text if this method "titleForHeaderInSection" returns in iPhone sdk?
I am unable to display the total information if the results are nil in iPhone.
-(NSString *)tableView:(UITableView *)tableView titleFor开发者_开发技巧HeaderInSection:(NSInteger)section { if ([customerList count] == 0) { return @"Could not find any doctor with your search. Please try again."; } return @""; }
I Declared the table as below myTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, 320,370) style:UITableViewStylePlain];
Here I can display the text upto ... "Could not find any doctor with your......" How can I show full or total information, Please suggest the solution. Thanking You, Madan Mohan
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
Try out this delegate and pass on a view with multilines label.. it will work...
hAPPY cODING...
the method (NSInteger)numberOfSectionsInTableView delivers how many sections are present in the current UTableView datasource.
if your datasource is empty, it will provide "0". therefore, your titleForHeaderInSection-method will never be called because of that zero.
if you really want to display that message inside a section header, try something like this:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
if([customerList count == 0]) return 1;
else return [[customerList getSections] count]; // or how ever you get the total of sections in your datasource
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
if([customerList count] == 0) return 0;
else return [[customerList getSection:section] count] // or whatever you have implemented :)
}
精彩评论