2013-10-03 4 views
5

AppleはiOSの6.1 SDKのiOS 7を使用してiOS 7の非表示のUITableViewCellScrollViewにアクセスしますか?

<UITableViewCell> 
    | <UITableViewCellContentView> 
    | | <UILabel> 

を使用してiOSの7に

UITableViewCell階層を変更SDK

<UITableViewCell> 
    | <UITableViewCellScrollView> 
    | | <UITableViewCellContentView> 
    | | | <UILabel> 

私の問題は、デフォルトではそのUITableViewCellScrollView.layer.masksToBounds = TRUEであり、私はそれをする必要があります偽です。

私は次のことを試してみました:

UIView * scrollView = [self.subviews objectAtIndex:0]; 
scrollView.layer.masksToBounds = NO; 

[self.myLabel.superview.layer setMasksToBounds:NO]; 

しかし、それらの非はUITableViewCellScrollViewを変更します。 このスクロールビューにはどのようにアクセスできますか?

答えて

7

新しいCellScrollViewにアクセスする唯一の方法は、作成したセルスーパービューにアクセスすることです。

私は次のようcellForRowAtIndexPathを追加しました:

cell = [[UICustomTableViewCell alloc] init]; 
UIView *cellScrollView = cell.myLabel.superview; 
[cellScrollView.layer setMasksToBounds: NO]; 

私はAppleが私たちにハッキングすることなく、この新しいScrollViewにアクセスする方法を与えるべきだと思います。

2

のObjective-C:

UIView *cellScrollView = [[cell contentView] superview]; 
[cellScrollView setClipsToBounds:NO]; 

スウィフト:

let cellScrollView = cell.contentView.superview 
cellScrollView?.clipsToBounds = false 
関連する問題