小编Tab*_*Tab的帖子

如何扩展UIButton的hitTest区域而不挤出它的背景图像?

我已经设置了UIButton背景图像并在其上添加了标题(我setBackgroundImage没有使用方法setImage).现在我想扩展a的hitTest区域UIButton而不挤出它的背景图像.

我怎样才能做到这一点?

iphone objective-c uibutton ios

4
推荐指数
3
解决办法
3802
查看次数

Objective-c中的一种奇怪的类型转换

我发现了一个使用类型转换的演示片段,如下所示:(int)view.'view'是UIView对象的指针.我从来不知道它可以用于铸造类型.有人可以帮我解释一下吗?粘贴代码在这里

- (CGPoint)accelerationForView:(UIView *)view
{
    // return
    CGPoint accelecration;

    // get acceleration
    NSValue *pointValue = [self._accelerationsOfSubViews objectForKey:
                                     [NSNumber numberWithInteger:(int)view]];
    if (pointValue == nil) {
        accelecration = CGPointZero;
    }
    else {
        [pointValue getValue:&accelecration];
    }

    return accelecration;
}

- (void)willRemoveSubview:(UIView *)subview
{
    [self._accelerationsOfSubViews removeObjectForKey:
                         [NSNumber numberWithInt:(int)subview]];
}
Run Code Online (Sandbox Code Playgroud)

casting objective-c uikit ios

3
推荐指数
1
解决办法
402
查看次数

标签 统计

ios ×2

objective-c ×2

casting ×1

iphone ×1

uibutton ×1

uikit ×1