带有 UIPickerView 和“完成”、“下一个”、“上一个”按钮的 UIActionSheet
我正在尝试实现一个操作表,其中包含选择器视图和分段控制栏,其中包含上一个按钮、下一个按钮和完成按钮,如下图所示 https://i.sstatic.net/SX61b.jpg。我目前可以使它看起来像这样 https://i.sstatic.net/jpljb.jpg。我想知道是否有人可以帮助我将选择器视图放在底部并使其看起来更好一点。感谢您的任何帮助。
i am trying to implement an action sheet that contains a picker view and a segmented control bar with a previous button, next button and done button like the image as follows https://i.sstatic.net/SX61b.jpg. I currently am able to make it look like this https://i.sstatic.net/jpljb.jpg. I was wondering if someone could help me get the picker view to sit on the bottom and just make it look a little better. Thanks for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
除非您的目标是非常旧的 iOS 版本(即早于 3.2 的版本),否则最好的方法是采用完全不同的方法。
从 3.2 开始,任何 UIResponder(包括所有 UIView)都可以从其
inputView
属性返回 UIView,以在视图成为第一响应者时显示该视图而不是键盘。这甚至适用于通常不会成为第一响应者或根本不显示键盘的视图。很简单:canBecomeFirstResponder
返回 YES。inputView
返回弹出视图的实例。更多详细信息请参阅 文档。
另外,顺便说一句,如果您使用的是 iPad,您可能应该使用 UIPopoverController 来显示 UIPickerView,而不是使用这些方法。苹果 实际上可能需要此操作。
Unless you're targeting very old versions of iOS (i.e. versions earlier than 3.2), the best way to do it is to take a completely different approach.
As of 3.2, any UIResponder (which includes all UIViews) can return a UIView from its
inputView
property to show that view instead of the keyboard when the view becomes the first responder. This even works for views that normally don't become first responder or don't display the keyboard at all. It's simple:canBecomeFirstResponder
.inputView
.More details are available in the documentation.
Also, BTW, if you're on an iPad you should probably use a UIPopoverController to display a UIPickerView instead of either of these methods. Apple may actually require this if you intend to get your app in the app store.
下一个和上一个按钮实际上是在工具栏中将图像显示给segmentedController。为了得到它你必须定义segmentedController和UIToolbar。 H.接下来添加DataSource和UIPickerView
然后在viewDidLoad中创建对象并定义它们的属性。例如:
The next and previous buttons are actually showing your images to segmentedController Within a toolbar. To get it You have to define the segmentedController and UIToolbar on. H. Next add the DataSource and UIPickerView
Then in the viewDidLoad create objects and define Their properties. For example: