![](/img/trans.png)
[英]implicit conversion loses integer precision 'NSUInteger' (aka 'unsigned long') to 'int' when making app?
[英]Implicit conversion loses integer precision: 'unsigned long' to 'int' - Error
我在這里看到了關於相同錯誤的一些問答,但是它們都沒有幫助。 我仍然遇到相同的錯誤。 我需要更改什么? 這就是我現在所擁有的。
錯誤與這條線有關:imageIndex =(imageIndex <0)? ([圖像計數] -1):
感謝您的幫助!
#import "Photogallery.h"
@interface Photogallery ()
@end
@implementation Photogallery
@synthesize imageView;
int imageIndex = 10;
- (void)viewDidLoad {
[super viewDidLoad];
}
- (IBAction)handleSwipe:(UIGestureRecognizer *)sender {
NSArray *images=[[NSArray alloc]initWithObjects:@"1.jpg",@"2.jpg",@"3.jpg",@"4.jpg",@"5.jpg",@"6.jpg",@"7.jpg",@"8.jpg",@"9.jpg",@"10.jpg", nil];
UISwipeGestureRecognizerDirection direction = [(UISwipeGestureRecognizer *)sender direction];
switch (direction) {
case UISwipeGestureRecognizerDirectionLeft:
imageIndex++;
break;
case UISwipeGestureRecognizerDirectionRight:
imageIndex--;
break;
default:
break;
}
imageIndex = (imageIndex < 0) ? ([images count] -1):
imageIndex % [images count];
imageView.image = [UIImage imageNamed:[images objectAtIndex:imageIndex]];
}
@end
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.