UITextView自动完成气泡位置



在UITextView中输入数据时,我对自动完成气泡位置感到困惑。

我观察到的是,根据其框架的起源,自动完成的气泡要么出现在顶部,要么出现在底部。没有固定的位置,条件是scrollEnabled设置为no

这是两个链接。代码是用init()编写的

http://www.flickr.com/photos/26021742@N00/6975525835/

UIView *view = [[[UIView alloc] initWithFrame:CGRectMake(0, 150, 320, 41)] autorelease];
view.backgroundColor = [UIColor grayColor];
[self.view addSubview:view];
UITextView *growingTextView = [[UITextView alloc] initWithFrame:CGRectMake(0, 10, 200, 27)];
growingTextView.font = [UIFont fontWithName:@"Helvetica" size:13];
growingTextView.scrollEnabled = NO;
[view addSubview:growingTextView];

http://www.flickr.com/photos/26021742@N00/6975525727/

    UIView *view = [[[UIView alloc] initWithFrame:CGRectMake(0, 50, 320, 41)] autorelease];
    view.backgroundColor = [UIColor grayColor];
    [self.view addSubview:view];
    UITextView *growingTextView = [[UITextView alloc] initWithFrame:CGRectMake(0, 10, 200, 27)];
    growingTextView.font = [UIFont fontWithName:@"Helvetica" size:13];
    growingTextView.scrollEnabled = NO;
    [view addSubview:growingTextView];

有人能解释这种观察到的行为吗???

我知道弹出窗口和气泡总是会自动调整它的位置,以便于使用。它已经出现在苹果的代码中,在这两张图片中,气泡的位置都是有意义的。

最新更新