Is there a way that I can make an overlay view on the iPhone SDK?

天大地大妈咪最大 提交于 2019-12-12 18:06:35

问题


I've seen examples of overlay views in different iPhone apps (Skype, Phone.app (while making a call), Google Mobile) and I was wondering how I could do the same in an app.

I'm making an app which has a record button in it and when that button is pressed, I want a nice looking overlay (similar to the overlay view that appears when making a call on the iPhone) that says "Recording" with a count in seconds to appear along with a stop button.

Is there any guide or anything I can look at to help me do this? Thanks.

Also I was wondering how I can make a vertically long view that requires the user to scroll with their finger that isn't a TableView. Also thanks.


回答1:


I usually just create them myself; it's just a UIView which you insert above your other subviews.

UIView *overlayView = [[UIView alloc] initWithFrame:self.view.frame];
overlayView.backgroundColor = [UIColor blackColor];
overlayView.alpha = 0.4;
[self.view addSubview:overlayView];
[overlayView release];

As for your second question check out UIScrollView's.




回答2:


For scrolling you need a UIScrollView. Look at the class reference for examples on how to use it.

For my overlays I push a new modal view which I make transparent.



来源:https://stackoverflow.com/questions/2253334/is-there-a-way-that-i-can-make-an-overlay-view-on-the-iphone-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!