Iphone Can';在UIActionSheet中输入UITextField
按钮触发创建UIActionSheet的函数。看起来像这样:Iphone Can';在UIActionSheet中输入UITextField,iphone,objective-c,ios,xcode,cocoa-touch,Iphone,Objective C,Ios,Xcode,Cocoa Touch,按钮触发创建UIActionSheet的函数。看起来像这样: reportSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil
reportSheet = [[UIActionSheet alloc]
initWithTitle:nil
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil
];
[reportSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent];
newComment = [[UITextField alloc] initWithFrame:CGRectMake(10, 10, 300, 200)];
newComment.backgroundColor = [UIColor redColor];
newComment.delegate = self;
[reportSheet addSubview:newComment];
[newComment release];
当我将UITextField添加到此操作表时,我无法在其中键入任何内容。键盘出现了,但当我按下按钮时什么也没发生。该标记仅位于位置0并闪烁。
此代码如下所示:
reportSheet = [[UIActionSheet alloc]
initWithTitle:nil
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil
];
[reportSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent];
newComment = [[UITextField alloc] initWithFrame:CGRectMake(10, 10, 300, 200)];
newComment.backgroundColor = [UIColor redColor];
newComment.delegate = self;
[reportSheet addSubview:newComment];
[newComment release];
如果我将TextField添加到self.view(而不是上面的reportSheet),它工作正常,并且键入它没有问题
有什么问题吗?试试看
[newComment.layer addAnimation:[reportSheet.layer animationForKey:reportSheet.layer.animationKeys.lastObject] forKey:reportSheet.layer.animationKeys.lastObject];
[[reportSheet superview] addSubview:newComment];
试一试
您可能会看到@,我认为
UITextField
的帧大小有问题。您可能会看到@,我认为UITextField
的帧大小有问题