有没有改变弹出窗口的外观?我有兴趣将边框更改为更亮或更透明然后黑色
答案 0 :(得分:1)
以下是如何显示简单弹出窗口的示例,该弹出窗口将在几秒钟后显示为动画并消失动画。头文件:
@interface ViewPopup : UIView
{
IBOutlet UILabel *m_lblMessage;
}
@property (nonatomic, retain) UILabel *m_lblMessage;
- (void) showFromView: (UIView*)viewParent;
实施部分:
@implementation ViewPopup
@synthesize m_lblMessage;
- (void) showFromView: (UIView*)viewParent
{
[viewParent addSubview:self];
[self setCenter: CGPointMake(viewParent.frame.size.width/2, -self.frame.size.height/2)];
[UIView beginAnimations: @"ShowPopup" context: nil];
[UIView setAnimationDuration: 0.5];
[UIView setAnimationDelegate: self];
[UIView setAnimationDidStopSelector: @selector(onAppeared)];
self.transform = CGAffineTransformMakeTranslation(0, self.frame.size.height+40);
[UIView commitAnimations];
}
- (void) onAppeared
{
[self performSelector: @selector(hide) withObject: nil afterDelay: 3];
}
- (void) hide
{
[UIView beginAnimations: @"HidePopup" context: nil];
[UIView setAnimationDuration: 1];
[UIView setAnimationDelegate: self];
[UIView setAnimationDidStopSelector: @selector(removeFromSuperview)];
self.transform = CGAffineTransformIdentity;
[UIView commitAnimations];
}
- (void)dealloc
{
[m_lblMessage release];
[super dealloc];
}
从任何视图和代码中的任何位置调用:
ViewPopup *viewPopup = (ViewPopup*)[[NSBundle mainBundle] getViewFromNib: @"ViewPopup" class: [ViewPopup class] owner: nil];
viewPopup.m_lblMessage.text = @"Hello";
[viewPopup showFromView: someView];
请注意,弹出图形是从ViewPopup.xib文件加载的。它只有一些图形和文字标签。
答案 1 :(得分:0)
我不这么认为......我一直在试图解决同样的问题。现在看来,黑色是唯一的选择。