【发布时间】:2017-11-16 05:43:58
【问题描述】:
我想在应用委托上显示一些警报。当我点击按钮时,警报应该留在那里。如果在 5 分钟内没有采取任何行动,则该警报想要解除。有人请帮我创建一个自定义警报。 常量 CGFloat 字体大小 = 24; // 或者其他。
UILabel* label = [[UILabel alloc] initWithFrame:CGRectZero];
label.backgroundColor = [UIColor clearColor];
label.font = [UIFont fontWithName:@"Helvetica-Bold" size:fontSize]; // Or whatever.
label.text = message;
label.textColor = [UIColor blueColor]; // Or whatever.
[label sizeToFit];
label.center = point;
[self.view addSubview:label];
[UIView animateWithDuration:0.3 delay:1 options:0 animations:^{
label.alpha = 0;
} completion:^(BOOL finished) {
label.hidden = YES;
[label removeFromSuperview];
}];
【问题讨论】:
-
那是什么问题?
-
你应该检查 UIPresentationController 类
标签: ios objective-c xcode uiview uialertview