ios - Fast enumeration situation -
i'm working fast enumeration variables, seems simple can't make work.
i have code, work
for (nsdictionary *story in stories){ nslog(@"%@", [story objectforkey:@"title"]); }
this prints every single key stored in tittle. now, try this
for (nsdictionary *story in stories){ nslog(@"%@", [story objectforkey:@"title"]); nsstring *titles = [story objectforkey:@"title"]; [self.bigtext settext:titles]; }
and print one. why?
nevermind, figured out myself.
nsmutablestring *string = [[nsmutablestring alloc] init]; (nsdictionary *story in stories){ nslog(@"%@", [story objectforkey:@"title"]); [string appendstring:[nsstring stringwithformat:@"%@", [story objectforkey:@"title"]]]; } self.bigtext.text = string;
Comments
Post a Comment