Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
I have both a UITextLabel and a UITextView occupying the same real estate, point-for-point in my view. I have an NSMutableArray allocated to populate the UITextLabel based on what the user taps in a table. I would also like to program the app to use the UITextView if and only if the user taps on one specific row. I think this can be accomplished with an if-else or if-else if statement, but I'm not sure. If that will work, I don't know what to put in the if part of the code. So far, I have this:
if (qux == ??) {
fooTextView.text = textString;
} else {
fooTextLabel.text = textString;
}
I don't know what to set the if statement to. I tried to set it to
if (qux == the really long code containing the single array statement I want displayed as a UITextView)
but that returned an error. Does anyone have a suggestion on how to get Xcode to recognize my single NSMutableArray table cell with the UITextView and not (also) with the UILabel? As of right now, the app builds but displays the text both in the UITextView, so it scrolls and does exactly what I want and also in the UILabel but is static and visible "underneath" the scrolling UITextView.
Also, I'm using an NSMutable Array with initWithObjectAndKeys. In this special case that is the only one of its kind in my UITableView, I use a special key that is only used by this particular part of the array. Is it possible to set it up so it's something regarding:
if (qux == NSMutableArray with the special key) {
fooTextView.text = textString;
} else {
fooTextLabel.text = textString;
}
And should I be using an if-else if statement or just an if-else statement?
I have both a UITextLabel and a UITextView occupying the same real estate, point-for-point in my view. I have an NSMutableArray allocated to populate the UITextLabel based on what the user taps in a table. I would also like to program the app to use the UITextView if and only if the user taps on one specific row. I think this can be accomplished with an if-else or if-else if statement, but I'm not sure. If that will work, I don't know what to put in the if part of the code. So far, I have this:
if (qux == ??) {
fooTextView.text = textString;
} else {
fooTextLabel.text = textString;
}
I don't know what to set the if statement to. I tried to set it to
if (qux == the really long code containing the single array statement I want displayed as a UITextView)
but that returned an error. Does anyone have a suggestion on how to get Xcode to recognize my single NSMutableArray table cell with the UITextView and not (also) with the UILabel? As of right now, the app builds but displays the text both in the UITextView, so it scrolls and does exactly what I want and also in the UILabel but is static and visible "underneath" the scrolling UITextView.
Also, I'm using an NSMutable Array with initWithObjectAndKeys. In this special case that is the only one of its kind in my UITableView, I use a special key that is only used by this particular part of the array. Is it possible to set it up so it's something regarding:
if (qux == NSMutableArray with the special key) {
fooTextView.text = textString;
} else {
fooTextLabel.text = textString;
}
And should I be using an if-else if statement or just an if-else statement?
You didn't really tell us that the "qux" in your code is, but here's how I'd go about doing things. If you know where in your table the one specific row is (it is fixed) then it's simply a matter of implementing
You didn't really tell us that the "qux" in your code is, but here's how I'd go about doing things. If you know where in your table the one specific row is (it is fixed) then it's simply a matter of implementing
That's exactly what I was looking for. "qux" was the name of the array, but I guess that's irrelevant because the code needs to point to indexPath.row, not the array as whole?
So, I threw that code in, but don't know what to change "specificCellRow" to. I played around with it for a few minutes, but everything I tried returned an error. I want it to point to cell #1 in the UITableView. If it's the same result via a different method, could it also point to that specific data in the array? The only problem with that is my NSMutableArray is set up as:
That's exactly what I was looking for. "qux" was the name of the array, but I guess that's irrelevant because the code needs to point to indexPath.row, not the array as whole?
So, I threw that code in, but don't know what to change "specificCellRow" to. I played around with it for a few minutes, but everything I tried returned an error. I want it to point to cell #1 in the UITableView. If it's the same result via a different method, could it also point to that specific data in the array? The only problem with that is my NSMutableArray is set up as:
indexPath.row is simply the row index number, starting from 0 if I remember correctly. If you table doesn't have sections, you don't have to worry about anything else. If you have sections, then the indexPath will have both the index of the section and the index of the cell in that section.
indexPath.row is simply the row index number, starting from 0 if I remember correctly. If you table doesn't have sections, you don't have to worry about anything else. If you have sections, then the indexPath will have both the index of the section and the index of the cell in that section.
Replies
iPhone development tips and tutorials
Apps in store:
<a href="htt
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeSo, I threw that code in, but don't know what to change "specificCellRow" to. I played around with it for a few minutes, but everything I tried returned an error. I want it to point to cell #1 in the UITableView. If it's the same result via a different method, could it also point to that specific data in the array? The only problem with that is my NSMutableArray is set up as:
array = [[NSMutableArray alloc] init];
array addObject: [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"Steve", @"name", @"Male", @"gender", nil];
array addObject: [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"Mike", @"name", @"Male", @"gender", nil];
array addObject: [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"Pete", @"name", @"Male", @"gender", nil];
etc.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeiPhone development tips and tutorials
Apps in store:
<a href="htt
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome