Iphone – listing of all methods of a control – like required – iPhone

iphone

yesterday I just asked following question.


How to customize tableView Section View – iPhone


I found some new method.

Even in apple documentation I didn't found this method.

Is it some thing like hidden methods?

Does anybody provides all methods listing?
Including sample code.

Say for example.
UITableView methods

Whenever I insert tableView in my view Controller.

I have to either type or copy from some where.

If I want to include picker I have to find out UIPicker methods,
sameway
Alertview, ActionSheet, Tab Bar Controller all has different methods.

Isn't it possible, like if we include A tableView in our ViewController, Automatically all tableview methods are added to .m file.

(For example, A navigation based application has all tableView methods in rootview controller by default)

Let Me Clarify Again,

"I need proper source where all methods (like rootview controller has almost all table methods) "

So, when ever I want to add any control I just copy the code & add to my Project.

The reason Behind this
"We can target on the work instead of finding proper methods & typing them."

See, Suppose If I add a Table View to my View Controller, I must have the methods like ..didSelectAtRow..,..CellForRow…,etc.

So, after adding tableView – for managing table view I have to go for finding methods & type them in my .m file.

Suppose, I add tableView. All methods should be added to my .m file as given below.

<pre>

pragma mark Table view methods

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 0;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
return cell;
}
// Override to support row selection in the table view.
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Navigation logic may go here — for example, create and push another view controller.
// AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil];
// [self.navigationController pushViewController:anotherViewController animated:YES];
// [anotherViewController release];
}

// Override to support conditional editing of the table view.
– (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the specified item to be editable.
return YES;
}

// Override to support editing the table view.
– (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {

if (editingStyle == UITableViewCellEditingStyleDelete) {
    // Delete the row from the data source.
    [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}   
else if (editingStyle == UITableViewCellEditingStyleInsert) {
    // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view.
}   

}

// Override to support rearranging the table view.
– (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}

// Override to support conditional rearranging of the table view.
– (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the item to be re-orderable.
return YES;
}

Best Answer

I provided the answer to the question you mentioned - it definitely is in the Apple documentation (although as you say, not in the sample file). Remember the method name is

tableview:didSelectRowAtIndexPath

if you miss off the "tableview:" bit at the beginning and just search for

didSelectRowAtIndexPath

you won't find it in the documentation so easily.

If you look in the documentation that comes with XCode, you will see, for example, all methods that you can implement for the UITableview Delegate, including the one I posted to your previous answer. Just type "UITableview" into XCode help, and then select "UITableview delegate". It will then display all the methods available for you to call, and you can even just copy and paste them straight into your code.

I don't know if anyone's already done this and made the "template" classes you ask about available, but it should be very easy for you to do this yourself if you want.

Hope that helps

Related Topic