已经更新了今天的iOS 10扩展,实现了委托方法:
-(void)widgetActiveDisplayModeDidChange:(NCWidgetDisplayMode)activeDisplayMode withMaximumSize:(CGSize)maxSize
{
if (activeDisplayMode == NCWidgetDisplayModeCompact){
[UIView animateWithDuration:0.25 animations:^{
self.preferredContentSize = maxSize;
[self.view layoutIfNeeded];
}];
}
else if (activeDisplayMode == NCWidgetDisplayModeExpanded){
newHeight = [self getNewWidgetHeight];
[UIView animateWithDuration:0.25 animations:^{
self.preferredContentSize = CGSizeMake(0, newHeight);
[self.view layoutIfNeeded];
}];
}
}
Run Code Online (Sandbox Code Playgroud)
一切正常.但是,如果我将小部件保持在紧凑模式(显示更多选项)并且如果我重新运行/重新打开小部件屏幕,并且如果我点击"显示更多"按钮,即使委托方法被触发也没有任何反应.我应该按2次显示更多/更少,直到小部件开始扩展.我也收到这个错误:No active animation block!
我有一个对象数组,每个都有一个id,我想得到item.objectID在一个id数组中包含的所有项目,我怎样才能得到那个结果?
我试图做但我在创建predicateWithFormat时出错:无法解析格式字符串:
NSString *predicateFormat = [NSString stringWithFormat:@"SELF.itemID CONTAIN IN (1,2,3,4,5,6,7,8)"];
NSPredicate *predicate = [NSPredicate predicateWithFormat: predicateFormat];
filteredData = [localData filteredArrayUsingPredicate:predicate];
Run Code Online (Sandbox Code Playgroud)
我该怎么回避:
NSString *predicateFormat = [NSString stringWithFormat:@"SELF.itemID = 1 OR SELF.itemID = 2 OR SELF.itemID = 3"];
NSPredicate *predicate = [NSPredicate predicateWithFormat: predicateFormat];
filteredData = [localData filteredArrayUsingPredicate:predicate];
Run Code Online (Sandbox Code Playgroud)
因为还有其他条件要添加过滤器.
如何将分钟时间增量UIDatePicker从1 分钟更改为5分钟?
我注意到,简单地双击滚轮中的任何日期或时间都会将其从1分钟增加到5分钟.我如何以编程方式实现此目的.