如何在iPad中动态添加标签

如何在iPad中动态添加标签,ipad,xcode4.2,Ipad,Xcode4.2,我必须建立一个应用程序,我必须在其中添加动态标签,所以你能建议的方式请 - (void)addLabelWithText: (NSString*)text toView: (UIView*)view withFrame: (CGRect)frame { UILabel *label = [[UILabel alloc] initWithFrame: frame]; [label setText: text]; [view addSubview: label]; [

我必须建立一个应用程序,我必须在其中添加动态标签,所以你能建议的方式请

- (void)addLabelWithText: (NSString*)text toView: (UIView*)view withFrame: (CGRect)frame {
    UILabel *label = [[UILabel alloc] initWithFrame: frame];
    [label setText: text];
    [view addSubview: label];
    [label release];
}
以及viewController中的其他位置:

[self addLabelWithText: @"Cool Label" toView: [self view] withFrame: CGRectMake(0.0f, 0.0f, 200.0f, 200.0f)];