小编Sam*_*hen的帖子

如何在Images.xcassets中本地化图像?

我们可以在File Inspector使用中本地化图像,Localize...如下所示:

在此输入图像描述

然后我们可以得到这个:

在此输入图像描述

但现在,我使用Images.xcassets来管理我的iOS项目中的图像,我应该如何在Images.xcassets中本地化这些图像?

localization ios

53
推荐指数
5
解决办法
2万
查看次数

当我为UIImageView设置动画时,UITapGestureRecognizer不起作用

当我想要动画时UIImageView,UITapGestureRecognizer添加到它不能工作.为什么???

-(void) testTap:(id)sender {
    NSLog(@"Test tap...");
}

-(void) testSlide {
    UITapGestureRecognizer* testTap = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(testTap:)] autorelease];
    testTap.numberOfTapsRequired = 2;

    UIImageView* imageView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tip_slide"]] autorelease];
    [imageView setFrame:CGRectMake(40, 40, 200, 200)];
    imageView.userInteractionEnabled = YES;
    imageView.multipleTouchEnabled = YES;
    [imageView addGestureRecognizer:testTap];

    [self.view addSubview:imageView];


    // When I add the following code, the UITapGestureRecognizer will not work. WHY???
    imageView.alpha = 0;
    CGAffineTransform t = imageView.transform;
    if (CGAffineTransformIsIdentity(t)) {
        UIViewAnimationOptions options = UIViewAnimationCurveEaseInOut;
        [UIView animateWithDuration:1.0 delay:0 options:options animations:^{ …
Run Code Online (Sandbox Code Playgroud)

animation gesture ios uitapgesturerecognizer

8
推荐指数
1
解决办法
2689
查看次数

方法返回的对象是否会被放入自动释放池?

启用ARC时,将o在此代码段中放入自动释放池吗?

- (NSObject *)obj {
    NSObject *o = [[NSObject alloc] init];

    return o;
}
Run Code Online (Sandbox Code Playgroud)

更重要的是,这两个代码片段之间的区别是什么?

- (NSObject *)obj {
    NSObject * __autoreleasing o = [[NSObject alloc] init];

    return o;
}
Run Code Online (Sandbox Code Playgroud)

- (NSObject *)obj {
    NSObject * __strong o = [[NSObject alloc] init];

    return o;
}
Run Code Online (Sandbox Code Playgroud)

autorelease nsautoreleasepool ios automatic-ref-counting

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