3

UIProgressView を正常に配置した UIToolbar があります。ただし、一部のアプリには UIProgressView の上に小さなラベルが含まれており、ファイルのダウンロードなど、プログラムが進行中の場所で何を行っているかをユーザーに伝えます。ただし、これは UI Builder では実行できないようです。ツールバーの UIProgressView にラベルを追加する最良の方法に関するアイデアはありますか? ここに私が興味を持っているものがあります:

+------------------------------------------------+
|         Uploading File                         |
| ================--------------------  [CANCEL] |
+------------------------------------------------+
4

3 に答える 3

3

サブビューとしてとUIViewを含むカスタムを作成します。次に、カスタムをツールバーに挿入します。UILabelUIProgressViewUIView

于 2010-08-02T06:25:15.770 に答える
2

UIProgressView実際には、テキストをサブビューとして直接追加することもできます。例:

UIProgressView *videoProgressView = [[UIProgressView alloc] initWithFrame:CGRectMake(40, self.view.frame.size.height/2, self.view.frame.size.width - 80, 40)];

UILabel *processing = [[UILabel alloc] initWithFrame:CGRectMake(0, -50, videoProgressView.frame.size.width, 25)];
processing.text = @"Processing Video...";
processing.textAlignment = NSTextAlignmentCenter;

[videoProgressView addSubview:processing];

[self.view addSubview:videoProgressView];

UIProgressViewclipsToBoundsプロパティが NO に設定されていることを確認してください。

于 2015-01-27T22:55:20.557 に答える