2011-09-21 67 views
0

我正在使用Three20庫在我正在處理的iPhone應用程序中創建TTLauncherView。當用戶觸摸並保持在啓動器視圖中的其中一個項目時,它將導致所有項目開始擺動,並在每個項目圖像的左上角出現一個「x」按鈕。此按鈕用於從啓動器視圖中刪除項目。我想將這個「x」按鈕向下和向右移動到相對於物品圖像的位置。Three20中的「關閉按鈕」的偏移位置TTLauncherView

我已經看過TTDeafaultStyleSheet andfound下面的代碼:

/////////////////////////////////////////////////////////////////////////////////////////////////// 
- (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」按鈕,但我一直無法弄清楚如何改變其位置。有沒有人有什麼建議?

回答

0

我無法確定如何使用我的問題中的代碼來移動關閉按鈕,但我確實找到了通過編輯Three20文件TTLauncherButton.m來調整按鈕位置的方法。在 - (void)layoutSubviews方法中,我調整了_closeButton屬性的原點。