问题
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