如何在 Objective-c iPhone 的视图中显示特定尺寸(非全屏)的视图?
我想调用我的 xcode 项目中的特定视图。实际上,我已经创建了一个基于导航的应用程序。我在导航栏中添加了一个按钮。现在我想,当有人单击该按钮时,按钮列表的特定视图将打开,要求用户单击特定按钮。 我能想到的解决方案是创建一个视图并将其添加到按钮的单击上。 但我无法找到如何实现这一目标。帮帮我吗?
I want to call a particular view in my xcode project. Actually, I have created a navigation based application. I have added a button in the navigation bar. Now I want, when somebody click on that button then a particular view of button list open ask for user to click a particular button.
The solution which I can think for it is to create a view and add it on the button's click.
But I am not able to find how to achieve this. Help me out?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
创建一个 UIView 对象,根据需要设置 frame 属性,而不是完整尺寸。现在创建按钮,将其作为 sunview 添加到新创建的 UIView 中。
现在将您的 UIView 添加为主视图中的子视图。
Create an UIView object set the frame property as much you require not the full size Now create button add this as sunview to your newly created UIView.
Now Add your UIView as the subview in your main view.
我建议查看 UIActionSheet。这听起来像是一个完美的用例。
I recommend to look into UIActionSheet. This sounds like a perfect use case for it.
嘿桑吉特..
只需从 xib 或以编程方式添加按钮,然后获取该按钮的选择器(添加 IBAction 或 use[buuton addSelector:]),然后在该方法中执行类似的操作。
[self.view addSubview:dummyView];
hey sanchit..
simply add the button either from xib or programmaticaly and get a selector to that button (add IBAction or use[buuton addSelector:]) and in that method do something like this.
[self.view addSubview:dummyView];