gpt4 book ai didi

iphone - 如何在 UIWebview 表单中创建键盘的“确定”按钮?

转载 作者:行者123 更新时间:2023-12-03 17:35:39 25 4
gpt4 key购买 nike

当您单击 webform 时,这个蓝色的“确定”按钮在 UIWebview 中很常见。在 iPhone 上。

The blue OK button

有没有一种简单的方法可以在代码中重新创建它?或者我将不得不以艰难的方式创建它?

最接近的代码是:

    UISegmentedControl *buttonOK = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:@"OK"]];
[buttonOK setSegmentedControlStyle:UISegmentedControlStyleBar];
[buttonOK setTintColor:[UIColor colorWithRed:0.25f green:0.51f blue:0.95f alpha:1.0f]];
[buttonOK setFrame:CGRectMake(276, 8, 38, 30)];

但是不一样...

最佳答案

Web View 中的按钮使用带有完成按钮样式的半透明 UIToolbar:

UISegmentedControl* segmentedControl = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:@"Previous", @"Next", nil]];
segmentedControl.segmentedControlStyle = UISegmentedControlStyleBar;
segmentedControl.tintColor = [UIColor blackColor];
segmentedControl.momentary = YES;

UIBarButtonItem* segmentedControlItem = [[UIBarButtonItem alloc] initWithCustomView:segmentedControl];
UIBarButtonItem* item = [[UIBarButtonItem alloc] initWithTitle:@"OK" style:UIBarButtonItemStyleDone target:self action:@selector(done:)];
UIBarButtonItem* flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:NULL];
UIToolbar* toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 44.0f)];
toolbar.barStyle = UIBarStyleBlack;
toolbar.translucent = YES;
toolbar.items = [NSArray arrayWithObjects:segmentedControlItem, flexSpace, item, nil];
[self.view addSubview:toolbar];

关于iphone - 如何在 UIWebview 表单中创建键盘的“确定”按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10113649/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com