Read in string from user and convert to NSString
How can i store user input as a nsstring to be placed within an nsmutablearray? scanf is not working for string type.
-(NSString *) addMemo;
{
NSMutableArray *memoArray = [NSMutableArray ar开发者_如何学运维ray];
NSLog(@"Please add your memo.");
scanf("\n", &memo);
[memoArray addObject:memo];
}
You should be able to use NSString's stringWithCString:encoding: constructor to create an NSString from memo.
加载中,请稍侯......
精彩评论