2011-11-16 9 views
1

を取得しますインスタンスに送信された "例外が発生します。UISLider設定親指/ minimumTrack/maximumTrackの色合いの色は、私がUISLiderのプロパティを設定することができるはずdeveloper.appleによる例外

私はイメージのプロパティを設定することでこれに対する回避策があることを知っています。しかし、私はそのように行きたくありません。私が行方不明のものはありますか?

ご了承ください。前もって感謝します。ここで

はdeveloper.apple例のUICatalogプロジェクトからのコードです:

- (UISlider *)sliderCtl 
{ 
    if (sliderCtl == nil) 
    { 
     CGRect frame = CGRectMake(174.0, 12.0, 120.0, kSliderHeight); 
     sliderCtl = [[UISlider alloc] initWithFrame:frame]; 
     [sliderCtl addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventValueChanged]; 

     // in case the parent view draws with a custom color or gradient, use a transparent color 
     sliderCtl.backgroundColor = [UIColor clearColor]; 

     // I just added this following line to test 
     sliderCtl.thumbTintColor = [UIColor yellowColor]; 

     sliderCtl.minimumValue = 0.0; 
     sliderCtl.maximumValue = 100.0; 
     sliderCtl.continuous = YES; 
     sliderCtl.value = 50.0; 

     // Add an accessibility label that describes the slider. 
     [sliderCtl setAccessibilityLabel:NSLocalizedString(@"StandardSlider", @"")]; 

     sliderCtl.tag = kViewTag; // tag this view for later so we can remove it from recycled table cells 
    } 
    return sliderCtl; 
} 

答えて

4

あなたがいないiOS5をデバイス/シミュレータ上でこれを実行しようとしています。使用するAPIはiOS5でのみ使用できます。

+0

ありがとうございます。私はちょうど今それをテストしました。私がiOS 5シミュレータを選ぶとうまく動作します。しかし、 iEamin

+0

あなたが自分でベーキングしない限り、これをios4で取得することはできません。しかし、respondsToSelectorを使用してユニバーサルコードを使用することができます。彼らは4と5 –

関連する問題