开发者

Display a box with contents in Iphone View

开发者 https://www.devze.com 2023-02-01 12:04 出处:网络
I am working on an app which displays user information on the home开发者_高级运维 view. Its a regular tab bar application, which brings up the home view on load. I need to display something like,

I am working on an app which displays user information on the home开发者_高级运维 view. Its a regular tab bar application, which brings up the home view on load. I need to display something like,

Hello Joe,

Your current points are : xxx

I would like this to be in a white curved background box. (The background for the view is blue). Is there something like a UIPanel or something like that. I would really like to avoid having another view or a webView, not sure if thats going to affect the speed of loading the page.


If there were a UIPanel control it would derive from UIView, so I'm not sure why you want to avoid another view. If I'm understanding you, it sounds like you want a custom alert window of some sort. You could just use the UIAlertView control to display your message, but if you are dead set on a custom look, then you will need to use a view.

This shouldn't affect performance noticeably if you are just displaying some text with maybe a button on a custom image. Especially if this is just a tab bar application with nothing too crazy happening in the background (animations, etc.).

I would suggest creating a View either in code (this will be slightly faster, but once again probably not noticeably so) or with Interface Builder that has a black background with an opacity of like .2-.5 and on that view adding a UIImageView set to your custom image (a png of a white curved box with transparent corners). Then put a UILabel with your text and a button to dismiss it.

On load just instantiate the above view and add it to your current view. It will show your message modally. Then capture the button tap event to have it remove itself from it's superview.

There are plenty of examples of how to do exactly this out there and there are even other ways of doing it than what I've suggested. If you need further assistance let me know.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号