在我的项目中,我使用UICollectionView来显示图标网格.
用户可以通过单击分段控件来更改排序,该分段控件使用不同的NSSortDescriptor调用从核心数据中获取.
数据量始终相同,只是以不同的部分/行结束:
- (IBAction)sortSegmentedControlChanged:(id)sender {
_fetchedResultsController = nil;
_fetchedResultsController = [self newFetchResultsControllerForSort];
NSError *error;
if (![self.fetchedResultsController performFetch:&error]) {
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
}
[self.collectionView reloadData];
}
Run Code Online (Sandbox Code Playgroud)
问题是reloadData没有为更改设置动画,UICollectionView只是弹出新数据.
我应该跟踪更改前后单元格中的哪个indexPath,并使用[self.collectionView moveItemAtIndexPath:toIndexPath:]来执行更改动画,还是有更好的方法?
我没有太多进入子类化collectionViews所以任何帮助将是伟大的...
比尔,谢谢.
我正在尝试使用自定义segue来执行一种缩放动画.执行转换时,sourceViewController变黑,然后进行缩放.
试图将pushViewController:设置为完成块,但根本不执行转换.
- (void)perform {
UIViewController *sourceViewController = (UIViewController *) self.sourceViewController;
UIViewController *destinationViewController = (UIViewController *) self.destinationViewController;
[destinationViewController.view setTransform:CGAffineTransformMakeScale(0.5,0.5)];
[destinationViewController.view setAlpha:0.0];
[UIView animateWithDuration:0.5
delay:0.0
options:UIViewAnimationCurveEaseOut
animations:^{
[destinationViewController.view setTransform:CGAffineTransformMakeScale(1.0,1.0)];
[destinationViewController.view setAlpha:1.0];
[sourceViewController.navigationController pushViewController:destinationViewController animated:NO];
}
completion:^(BOOL finished){
}];
}
Run Code Online (Sandbox Code Playgroud)
我做错了什么?
我为用户位置创建了一个自定义MKAnnotationView:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
Run Code Online (Sandbox Code Playgroud)
{
if ([annotation isKindOfClass:[MKUserLocation class]]) {
if (navStatus == NavStatusHeadingEnabled) {
if ([annotation isKindOfClass:[MKUserLocation class]]) {
locationView = [[CustomLocationView alloc] initWithAnnotation:annotation reuseIdentifier:@"locationIdentifier"];
return locationView;
}
}
return nil;
}
Run Code Online (Sandbox Code Playgroud)
CustomLocationView.h
- (id)initWithAnnotation:(id <MKAnnotation>)annotation reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithAnnotation:annotation reuseIdentifier:reuseIdentifier];
if (self != nil)
{
self.backgroundColor = [UIColor clearColor];
blueDot = [UIImage imageNamed:@"userLocationDot.png"].CGImage;
CGImageRetain(blueDot);
CGPoint blueDotCenter = CGPointMake((self.frame.size.width - (CGImageGetWidth(blueDot) / 2)) / 2, (self.frame.size.height - (CGImageGetHeight(blueDot) / 2)) / 2);
blueDotLayer …
Run Code Online (Sandbox Code Playgroud) 如何查找包含多个项目的子类别的所有类别?我使用以下代码,但我得到"这里不允许多对多密钥".
我需要使用SUBQUERY吗?
NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@"Categories"];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY subcategories.items > 0"];
[request setPredicate:predicate];
Run Code Online (Sandbox Code Playgroud)
救命!:)
我将屏幕分成小块,然后设置每个块的动画以执行转换:
for (int x=0; x<number_of_x_splits; x++) {
for (int y=0; y<number_of_y_splits; y++) {
CGSize splitSize = CGSizeMake(screenBounds.width / number_of_x_splits, screenBounds.height / number_of_y_splits);
CATransformLayer *transformLayer = [CATransformLayer layer];
[transformLayer setFrame:CGRectMake(splitSize.width * x, splitSize.height * y, splitSize.width, splitSize.height)];
[transformLayer setPosition:CGPointMake((splitSize.width * x) + splitSize.width / 2, (splitSize.height * y) + splitSize.height / 2)];
... adding some sublayers to transformLayer...
CABasicAnimation *rotate = [CABasicAnimation animationWithKeyPath:@"transform.rotation.y"];
[rotate setDuration:5.0];
[rotate setFromValue:[NSNumber numberWithFloat:0]];
[rotate setToValue:[NSNumber numberWithFloat:M_PI]];
[rotate setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[rotate setTimeOffset:(1 / (number_of_x_splits + number_of_y_splits)) * …
Run Code Online (Sandbox Code Playgroud) 我希望自定义MKMapView userLocation注释,以绘制像官方地图应用程序一样的标题箭头.
我试图在viewForAnnotation中执行此操作:
- (MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id <MKAnnotation>)annotation
{
if ([annotation isKindOfClass:[MKUserLocation class]]) {
}
}
Run Code Online (Sandbox Code Playgroud)
但我无法找到接下来要做的事情来获取UserLocation的视图并自定义它.
非常感谢...
我是一名iOS/Cocoa开发人员,希望将我的一个应用程序移植到PC平台.我不关心编写多平台并维护一个应用程序.我将继续使用cocoa和cocoa touch进行iOS Mac开发.我选择将QT 5用于PC,我不确定它是否明智的选择但是它很容易理解c ++.如果不是请指出我正确的方向.
我的应用程序并不是非常复杂,但需要一些特殊的自定义,例如看起来像iOS表格视图的ListView,使用带有Twitter引导程序样式搜索框的自定义圆形窗口,我想监视一些全局OS事件,如击键,以及用户的其他应用程序目前正在与...合作.我也使用SQLite和AES加密.
我的问题是关于UI定制.
我应该开始学习并使用QML吗?我不确定究竟是什么,看起来非常简单的CSS,但我感觉更多是为嵌入式设备而设计并且有局限性......
如果我使用QML,我是否可以获得QT的全部功能?
我还有哪些其他选项可以使用QML来定制小部件(例如,在目标C中,我们使用子类化和绘制我们想要的任何内容或处理事件......)
我在Windows平台上缺乏经验.我应该使用VisualStudio C++而不是QT5吗?随着所有权的变化,我感到有些不安全.
我正在使用Core Data和一个预先填充的Store,其中一个实体具有二进制数据和外部存储复选框,可以在外部保存一些大图像,每次我在模拟器中运行应用程序并执行一个获取请求时,一个名为"A"的新文件夹由AppName保存的文档"内部文档已创建.
该文件夹包含我在运行应用程序时获取的一些图像.
问题是这个文件夹在应用程序终止时没有删除,并且应用程序的大小目前正在增加几GB!
我已经使用启用了Core Data的默认Xcode模板启动了这个项目.
我错过了什么 ?
ios ×5
iphone ×2
mkmapview ×2
core-data ×1
ipad ×1
nspredicate ×1
objective-c ×1
one-to-many ×1
qt ×1
relationship ×1
uiview ×1