Как разделить предложения на коробки / кадр - слово за словом? - PullRequest
0 голосов
/ 07 декабря 2011

Я пробовал что-то вроде

//Putting the sentence into array

NSString *list = (@"A book costs £50.,  Ken has saved £45.,  How much more does he need to save to buy the book?");
 NSArray *listItems = [list componentsSeparatedByString:@", "];

Но результат оказался не тем, что я хочу.Я хочу, чтобы каждый кадр содержал слово.например, [A] [книга] [расходы] ... и т. д.

    // to create a frame

    CGRect frame= CGRectMake(50, 60, 50, 50);
    comp *newBox = [[comp alloc] initWithFrame:frame ];
    [self.view addSubview:newBox]; 
    newBox.backgroundColor=[UIColor blueColor]
    This frame work fine, i just need to put the word in to each frame

1 Ответ

0 голосов
/ 07 декабря 2011

Попробуйте это

NSString *list = (@"A book costs £50.  Ken has saved £45.  How much more does he need to save to buy the book?");
NSArray *listItems = [list componentsSeparatedByString:@" "];
...