小编Jas*_*son的帖子

NSString或UILabel,带有反斜杠字母

是否有可能使单词中的某些字母有斜线?我有一个带有一个单词列表的tableview,我想通过"无声字母"画一个斜线

创建UILabel的最佳方法是什么?

在此输入图像描述

iphone ios

2
推荐指数
1
解决办法
156
查看次数

使用块枚举NSArray以查找和存储阵列中所有NSStrings的所有索引

我如何枚举包含多种类型对象的NSArray,以获取找到NSString的所有索引,然后能够通过说出类似的内容来按顺序引用每个索引...

NSString *firstOccurrence = [myArray objectAtIndex:firstOccurrence];
NSString *secondOccurrence = [myArray objectAtIndex:secondOccurrence];
NSString *thirdOccurrence = [myArray objectAtIndex:thirdOccurrence];
Run Code Online (Sandbox Code Playgroud)

谢谢!

编辑:我如何使用代码(更新@NJones示例.)

我需要字符串存储在数组中的索引的Integer值,以使用该值更新NSUInteger属性"wordDisplayed".

在我的代码中,我使用UIActionSheet的修改版本来接受块:https: //github.com/zoul/Lambda-Alert

NSIndexSet *stringLocations = [arrayInLesson indexesOfObjectsPassingTest:^(id obj, NSUInteger idx, BOOL *stop){
    return [(NSObject *)obj isKindOfClass:[NSString class]];
}];

NSArray *passingObjects = [arrayInLesson objectsAtIndexes:stringLocations];

sectionHeadersAct = [[LambdaSheet alloc] initWithTitle:@"Book 2 Lesson 1"];
[sectionHeadersAct addButtonWithTitle:@"D. E. F. & G. Teach New Letters" block:^{ 
    //Do nothing yet
}];
[sectionHeadersAct addButtonWithTitle:[passingObjects objectAtIndex:0] block:^{
    NSLog(@"First");
    wordDisplayed = theIndexOfThisStringIn_arrayInLesson;
}];
[sectionHeadersAct addButtonWithTitle:[passingObjects objectAtIndex:1] block:^{ 
    NSLog(@"Second"); …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios

0
推荐指数
1
解决办法
1934
查看次数

标签 统计

ios ×2

iphone ×2

objective-c ×1