【问题标题】:Offset position of "close button" in Three20 TTLauncherViewThree20 TTLauncherView中“关闭按钮”的偏移位置
【发布时间】:2011-09-24 00:51:11
【问题描述】:

我正在使用 Three20 库在我正在开发的 iPhone 应用程序中创建一个 TTLauncherView。当用户在启动器视图中触摸并按住其中一个项目时,它会导致所有项目开始摆动,并且“x”按钮出现在每个项目图像的左上角。此按钮用于从启动器视图中删除项目。我想将这个“x”按钮相对于项目图像稍微向下和向右移动。

我查看了 TTDeafaultStyleSheet 发现以下代码:

    ///////////////////////////////////////////////////////////////////////////////////////////////////
- (TTStyle*)launcherCloseButtonImage:(UIControlState)state {
    return
    [TTBoxStyle styleWithMargin:UIEdgeInsetsMake(-2, 0, 0, 0) next:
     [TTImageStyle styleWithImageURL:nil defaultImage:nil contentMode:UIViewContentModeCenter
                                size:CGSizeMake(10,10) next:nil]];
}


///////////////////////////////////////////////////////////////////////////////////////////////////
- (TTStyle*)launcherCloseButton:(UIControlState)state {
    return
    [TTShapeStyle styleWithShape:[TTRoundedRectangleShape shapeWithRadius:TT_ROUNDED] next:
     [TTInsetStyle styleWithInset:UIEdgeInsetsMake(1, 1, 1, 1) next:
      [TTShadowStyle styleWithColor:RGBACOLOR(0,0,0,0.5) blur:2 offset:CGSizeMake(0, 3) next:
       [TTSolidFillStyle styleWithColor:[UIColor blackColor] next:
        [TTInsetStyle styleWithInset:UIEdgeInsetsMake(-1, -1, -1, -1) next:
         [TTSolidBorderStyle styleWithColor:[UIColor whiteColor] width:2 next:
          [TTPartStyle styleWithName:@"image" style:TTSTYLE(launcherCloseButtonImage:) next:
           nil]]]]]]];
}

这段代码触摸了“x”按钮,但我无法弄清楚如何改变它的位置。有人有什么建议吗?

【问题讨论】:

    标签: three20


    【解决方案1】:

    我无法弄清楚如何使用问题中的代码以我想要的方式移动关闭按钮,但我确实通过编辑 Three20 文件 TTLauncherButton.m 找到了调整按钮位置的位置。在 -(void)layoutSubviews 方法中,我调整了 _closeButton 属性的原点。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-11-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多