如何将句子逐字分成框/框?
我尝试过类似的事情
//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
I tried something like
//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:@", "];
But the result wasn't what I want. I want each frame will contain a word. eg [A] [book] [costs] ...etc
// 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个
Try this