开发者

how to load nsnotification text from an array

开发者 https://www.devze.com 2023-01-31 17:40 出处:网络
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 tex

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 valu开发者_如何学Pythone.


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];
0

精彩评论

暂无评论...
验证码 换一张
取 消