我有一个NSArray具有name属性的对象.
我想通过过滤数组 name
NSString *alphabet = [agencyIndex objectAtIndex:indexPath.section];
//---get all states beginning with the letter---
NSPredicate *predicate =
[NSPredicate predicateWithFormat:@"SELF beginswith[c] %@", alphabet];
NSMutableArray *listSimpl = [[NSMutableArray alloc] init];
for (int i=0; i<[[Database sharedDatabase].agents count]; i++) {
Town *_town = [[Database sharedDatabase].agents objectAtIndex:i];
[listSimpl addObject:_town];
}
NSArray *states = [listSimpl filteredArrayUsingPredicate:predicate];
Run Code Online (Sandbox Code Playgroud)
但我得到一个错误 - "不能用不是字符串的东西做一个子串操作(lhs = <1,箭头> rhs = A)"
我怎样才能做到这一点?我想过滤数组中的第一个字母name为'A'.
当我缩放mapView时,我需要计算注释的数量,并获得在地图上显示的数组,然后,我需要重新加载我的表并显示仅在地图上显示的列表.
如何获得带注释的数字和数组?
我有UITableView与细胞.当我选择单元格 - 高度增加时,当我再次选择此单元格时 - 高度降低.在方法"didSelectRowAtIndexPath"我用这个 -
NSArray *indArr = [[NSArray alloc] initWithObjects:(NSIndexPath*)[timer userInfo], nil];
[self.tableView reloadRowsAtIndexPaths:indArr withRowAnimation:UITableViewRowAnimationFade];
Run Code Online (Sandbox Code Playgroud)
但是"UITableViewRowAnimationFade"动画已经褪色,并且细胞闪烁.我尝试了另一种动画,但它们也不合适(
如何避免这种影响并更新没有动画的单元格?
我有一个UITableViewCell由两个单词组成的文本标签.
如何更改单词的颜色; 将第一个单词设为绿色,将第二个单词设为红色?
我有6个UILocalNotifications.每个通知都有自己的"userInfo"
然后我删除通知号4,并有5个通知:
如何在通知中更改"userInfo"以获取:
保存代码 -
// Specify custom data for the notification
NSDictionary *infoDict = [NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"%i", i] forKey:@"notif"];
localNotif.userInfo = infoDict;
i = i + 1;
Run Code Online (Sandbox Code Playgroud)
德尔代码 -
if (flagTable == 1)
{
int numberPhoto = [[[UIApplication sharedApplication] scheduledLocalNotifications] count];
int numPhFlag = …Run Code Online (Sandbox Code Playgroud) ios ×5
objective-c ×2
uitableview ×2
cocoa-touch ×1
filter ×1
iphone ×1
mkannotation ×1
mkmapview ×1
nsarray ×1