开发者

iPhone PopUp RGB colors

I am presenting a UIView with an animation that takes half of the screen. I've seen it in many apps but could not 开发者_StackOverflowfind the appropriate RGB colors:

iOS uses it for example in "contacts":

http://img98.imageshack.us/img98/9402/image001u.png

I'm trying with :

bottomLayer.backgroundColor = [[UIColor colorWithRed:80.0/255.0 green:86.0/255.0 blue:97.0/255.0 alpha:1] CGColor];

but it's all whitey.

If anyone could get how this popup is designed...

Thanks!


You'll want to look at UIActionSheet. It will create the view for you and have the proper animations. Very easy to use.

You just need to implement the UIActionSheetDelegate Delegate method.

@interface MyViewController : UIViewController <UIActionSheetDelegate>

And then to make the action sheet:

UIActionSheet *choice = [[UIActionSheet alloc] initWithTitle:@"" 
                                                    delegate:self 
                                           cancelButtonTitle:@"Annuler" 
                                      destructiveButtonTitle:nil 
                                           otherButtonTitles:@"Prendre une photo",@"Choisir une photo",nil];
[choice showInView:self.view];

And that will call:

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex 

Which is just like the UIAlertView.


There is a great utility called "DigitalColor Meter" located in Applications/Utilities/ that can get the RGB for anything on your screen. I find this incredibly helpful.


This the standard UIActionSheet background. See the UIActionSheet Class Reference for more information.

Incidentally, the NavBar sample code (linked from within the Related sample code section of the above class reference), is quite a good demo of such things.


If you want to set the color to a normal view and wonder why its white then the answer is you don't have to CGColor it

bottomLayer.backgroundColor = [UIColor colorWithRed:80.0/255.0 green:86.0/255.0 blue:97.0/255.0 alpha:1];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜