Alex Stelea
Alex Stelea

Reputation: 1219

how to load nsnotification text from an array

I am wondering how its possible to load the text displayed in an nsnotifcation using an array? I want the message shown in this notification to be loaded from an array and not for it to be a fixed text value.

Upvotes: 0

Views: 94

Answers (1)

sudo rm -rf
sudo rm -rf

Reputation: 29524

Not sure what your question is asking, but if you have a NSString as an object in an array, you can access it by using:

NSString *yourMessageString = [yourArray objectAtIndex:0];

for example.

EDIT: To set the alert message to the message in the array, simply do this:

UIAlertView *alert = [[UIAlertView alloc] 
                     initWithTitle:@"Your Title" 
                     message:[yourArray objectAtIndex:0] 
                     delegate:self 
                     cancelButtonTitle:@"OK" 
                     otherButtonTitles:nil];
[alert show];
[alert release];

Upvotes: 1

Related Questions