1

ユーザーが UIButton をタップしたときに UITextField を含むポップオーバーを表示する iPad アプリ (XCode 4.6、ARC、ストーリーボード) があります。

ポップオーバーが表示され、キーボードが表示されますが、UITextField には何も表示されません。私は何が欠けていますか?

コードは次のとおりです。

    //  make the popover
UIViewController* popoverContent = [[UIViewController alloc] init];
UIView* popoverView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 450, 500)];
popoverView.backgroundColor = [UIColor colorWithWhite:(CGFloat)1.0 alpha:(CGFloat)1.0];  //  frame color?
popoverContent.view = popoverView;

//resize the popover view shown in the current view to the view's size
popoverContent.contentSizeForViewInPopover = CGSizeMake(450, 500);

//  add the UITextfield to the popover
UITextField *tf = [[UITextField alloc]init];
[tf becomeFirstResponder];
[popoverView addSubview:tf];

//create a popover controller
popoverController = [[UIPopoverController alloc] initWithContentViewController:popoverContent];

[popoverController presentPopoverFromRect:((UIButton *)oSendFeedback).frame inView:self.view
                 permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
4

1 に答える 1

1

テキストフィールドはで作成する必要があります

UITextField *tf = [[UITextField alloc] initWithFrame:...]

フィールドの原点とサイズを指定します。

于 2013-08-02T20:25:48.453 に答える