具有外部Web内容的iOS弹出/启动画面

时间:2022-09-10 20:25:29

I need to display a popup or something like a splash screen every time I start my app. The content of this popup must be taken from an external web source (something like jpg, png or pdf). The purpose of this popup is to warn users about news and special offers. The popup should disappear after a certain time (or at the pressure of a button).

我每次启动应用程序时都需要显示弹出窗口或类似启动画面的内容。此弹出窗口的内容必须来自外部Web源(如jpg,png或pdf)。此弹出窗口的目的是警告用户有关新闻和特别优惠的信息。弹出窗口应该在一定时间后(或按下按钮的压力)消失。

From what I read on other threads, the UIPopoverController feature seems be helpful for what I need (as I read in this class reference), but I'm afraid that the main function of this popup is presenting a choice in result of the pressure of a button.

从我在其他线程上看到的内容来看,UIPopoverController功能似乎对我需要的内容有帮助(正如我在这个类引用中所读到的那样),但我担心这个弹出窗口的主要功能是在压力的结果中提供一个选择。一个按钮。

1 个解决方案

#1


3  

Why can you not simply add a webview to the screen when the app opens?

为什么你不能在应用程序打开时简单地将webview添加到屏幕上?

Like:

in appDelegate:

UIWebview *popover;

- (void)applicationDidBecomeActive:(UIApplication *)application
{
     UIWindow *win = [[UIApplication sharedApplication] keyWindow];

     popover = [[UIWebView alloc] initWithFrame:win.bounds];

     ... load content ...

     [win addSubview:popover];


     [self performSelector:@selector(dismissPopover) withObject:nil afterDelay:3];
}

-(void)dismissPopover
{
     [popover removeFromSuperview];
}

#1


3  

Why can you not simply add a webview to the screen when the app opens?

为什么你不能在应用程序打开时简单地将webview添加到屏幕上?

Like:

in appDelegate:

UIWebview *popover;

- (void)applicationDidBecomeActive:(UIApplication *)application
{
     UIWindow *win = [[UIApplication sharedApplication] keyWindow];

     popover = [[UIWebView alloc] initWithFrame:win.bounds];

     ... load content ...

     [win addSubview:popover];


     [self performSelector:@selector(dismissPopover) withObject:nil afterDelay:3];
}

-(void)dismissPopover
{
     [popover removeFromSuperview];
}