0

SMS アプリの上部に表示される UIButtons ([以前のメッセージを読み込む] ボタンなど) を再作成するにはどうすればよいですか。これらは、グラデーション、わずかな影のドロップ シャドウと内側の影、および青い境界線を除いて、非常に標準的な UIButton のように見えます。Apple はこれらを作成するために伸縮可能な UIImage を使用していますか、それともプログラムで (そしてどのように) 作成されていますか?

ここに画像の説明を入力

4

1 に答える 1

1

この問題に対する私のお気に入りの解決策は、正確に 1 つのセグメントを持つセグメント化されたコントロールを作成することです。見栄えの良いボタンになります。プログラムで行う方法は次のとおりです。

UISegmentedControl* takePhotoButton = 
     [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:@"Take Photo"]];
takePhotoButton.segmentedControlStyle = UISegmentedControlStyleBar;
takePhotoButton.frame = CGRectMake(55,336,110,38);
takePhotoButton.tintColor = [UIColor lightGrayColor];
NSDictionary *attributes = [NSDictionary dictionaryWithObject:[UIFont boldSystemFontOfSize:16]
                                                       forKey:UITextAttributeFont];
[takePhotoButton setTitleTextAttributes:attributes
                               forState:UIControlStateNormal];
takePhotoButton.momentary = YES;
[takePhotoButton addTarget:self
                    action:@selector(onTakePhoto:)
          forControlEvents:UIControlEventValueChanged];
[self.view addSubview:takePhotoButton];
于 2012-09-21T04:14:23.050 に答える