Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ljg93

macrumors member
Original poster
Mar 13, 2011
98
0
hey,

In my table view i have the code

Code:
[tableView deselectRowAtIndexPath:indexPath animated:YES];
	NSMutableString *rowName = [NSMutableString string];
	[rowName setString:[[[tableView cellForRowAtIndexPath:indexPath] textLabel] text]];
	[rowName replaceOccurrencesOfString:@" " withString:@"" options:0 range:NSMakeRange(0, [rowName length])];
	[rowName appendFormat:@"ViewController"];
	
	id newViewController = [[objc_getClass([rowName cStringUsingEncoding:NSUTF8StringEncoding]) alloc] init];
	[self.navigationController pushViewController:newViewController animated:YES];

it opens a view controller with the name of the row in the table, which is great put if for one cell in my table i want it to go directly to send a email instead of going to a separate nib that has a button that says click to send email
 
I don't see a question here. Simply a statement.

What, exactly, are you asking. What have you already tried to solve the problem you are having. What documentation have you read in your search for a solution?
 
I don't see a question here. Simply a statement.

What, exactly, are you asking. What have you already tried to solve the problem you are having. What documentation have you read in your search for a solution?


haha my question is, how can i change that code around to make a exception for only one cell in the table all the other cells in the table go to another nib, but i want one cell to go to not a nib. how would i go about that...

what documentation i have read- i have read a lot, i am not going to waste time and list it all

-what have i done- nothing i do not know how to do it, hence why i asked questions ;)
 
You have the indexPath. A quick glance at the documentation will show you that has useful properties like row. Use that to form a conditional statement. This seems pretty simple. Is there some specific difficulty with this?
 
You have the indexPath. A quick glance at the documentation will show you that has useful properties like row. Use that to form a conditional statement. This seems pretty simple. Is there some specific difficulty with this?

haha alright? sorry i asked a question that i did not understand i read that part of the documentation but did not understand it. maybe its understandable for you? No need to tell me that my question was basically worthless. this is my first post on this website and i am already very displeased with the "demi gods"response..
 
haha alright? sorry i asked a question that i did not understand i read that part of the documentation but did not understand it. maybe its understandable for you? No need to tell me that my question was basically worthless. this is my first post on this website and i am already very displeased with the "demi gods"response..

Please read these two very useful articles.

http://www.mikeash.com/getting_answers.html
http://whathaveyoutried.com/

Do you expect any of us to:
a) read your mind?
b) hand you an answer?

If you want to learn how to fish we'll help your learn, if all you want is fish, you may have to find them somewhere else.

B
 
Have you read through the Table View Programming Guide yet? If not, you should. It will help you to gain an understanding of table views. If you have, which section do you think would have information on the problem you're trying to solve?

i have, i dont know where in the documentation is explains to do this though
 
i have, i dont know where in the documentation is explains to do this though

The documentation is not there to provide detailed, step-by-step, guides that cover all possible situations. It is there to provide the information you need to solve problems by breaking them down into smaller and smaller tasks until you can solve the problems and re-combine the solutions. This is programming. Copy and pasting code is not.
 
The documentation is not there to provide detailed, step-by-step, guides that cover all possible situations. It is there to provide the information you need to solve problems by breaking them down into smaller and smaller tasks until you can solve the problems and re-combine the solutions. This is programming. Copy and pasting code is not.

who said anything about copy and pasting? i was just asking where the section in the documentation that explained the did select row and index path was..
hahah relax
 
i was just asking where the section in the documentation that explained the did select row and index path was..
No section explains exactly what you are seeking. But a few describe how to use a conditional based on the indexPath's row value to selectively perform some code. It is up to you to adapt this approach to solve your own problem.
 
No section explains exactly what you are seeking. But a few describe how to use a conditional based on the indexPath's row value to selectively perform some code. It is up to you to adapt this approach to solve your own problem.

hahah ok? no crap that is what you have to do... i was simply asking WHERE in the documentation of the table view held the basis of my problem..
so before you and the other "demi-god" go all hot shot on me read my question first before you assume.. could you guys be any more rude about it?
 
hahah ok? no crap that is what you have to do... i was simply asking WHERE in the documentation of the table view held the basis of my problem..
so before you and the other "demi-god" go all hot shot on me read my question first before you assume.. could you guys be any more rude about it?

Here's one example from the guide:

Code:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.row == 0 || indexPath.row%2 == 0) {
        UIColor *altCellColor = [UIColor colorWithWhite:0.7 alpha:0.1];
        cell.backgroundColor = altCellColor;
    }
}

another

Code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
 
    if (indexPath.section == 0) {
        return cell0;
    }
    // section 1
    if (indexPath.row == 0) {
        return cell1;
    }
    return cell2;
}

Do you maybe see how you could adapt those patterns for your needs?

EDIT: You seem to already be doing so in your other thread which seems to feed robbieduncan's assertion that you are copying and pasting code from somewhere without understanding it.

B
 
i was simply asking WHERE in the documentation of the table view held the basis of my problem..
Well, I've given you some clues as to what to search for in the guide. Or do you expect me to do the search for you and tell you where the location is? Learning to search existing documentation is a key skill in programming. You need to get used to doing it, on your own. Quite often you'll find that you get to answers much faster this way then waiting for an internet forum to respond, which isn't even guaranteed.

so before you and the other "demi-god" go all hot shot on me...
Our titles on this forum have nothing to do with this issue. Please don't drag that into things.

...read my question first before you assume..
Um, what exactly is it that you think we are assuming?

could you guys be any more rude about it?
I wasn't trying too be rude. I was trying to guide you, via hints, to finding the answer on your own. What I find rude is the way you attacked me when I'm trying to help you.

Sorry. I guess I'm not helping in the way you expect, so, I'm out. Good luck though.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.