xib でビューを作成しました (アクティビティ インジケーター、進行状況ビュー、およびラベルを使用)。次に、.h/.m ファイルを作成しました。
#import <UIKit/UIKit.h>
@interface MyCustomView : UIView {
IBOutlet UIActivityIndicatorView *actIndicator;
IBOutlet UIProgressView *progressBar;
IBOutlet UILabel *statusMsg;
}
@end
#import "MyCustomView.h"
@implementation MyCustomView
- (id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
// Initialization code
}
return self;
}
- (void)dealloc {
[super dealloc];
}
@end
IB では、ファイルの所有者とビュー ID を MyCustomView に設定し、IBOutlet をファイルの所有者に接続します。
MyViewController.m では、次のことを行いました。
- (void)viewDidLoad {
[super viewDidLoad];
UIView *subView = [[MyCustomView alloc] initWithFrame:myTableView.frame];
[subView setBackgroundColor:[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.5]];
[myTableView addSubview:subView];
[subView release];
}
アプリを実行すると、ビューが追加されますが、ラベル、進行状況バー、アクティビティ インジケーターが表示されません。
私は何を間違っていますか?