IOS 用代码配置启动页

IOS 用代码配置启动页,第1张

1,xcode版本10.1,首先在LaunchScreen.storyboard上设置一下StoryBoard ID 如图

2,在APPDelegate.m中增加属性:@property (strong, nonatomic) UIView *launchView

3,在- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions;中调用下面方法

-(void)setLaunchImg{

    UIViewController *viewController = [[UIStoryboard storyboardWithName:@"LaunchScreen" bundle:nil] instantiateViewControllerWithIdentifier:@"LaunchScreen"]

    self.launchView= viewController.view

    self.launchView.frame = CGRectMake(0, 0, self.window.screen.bounds.size.width, self.window.screen.bounds.size.height)

    [self.window addSubview:self.launchView]

    UIImageView*imageV = [[UIImageViewalloc]initWithFrame:CGRectMake(0,0,self.launchView.frame.size.width,self.launchView.frame.size.height)]

    [imageVsetImage:[UIImageimageNamed:@"logo.jpeg"]]

    imageV.contentMode = UIViewContentModeScaleAspectFill

    [self.launchViewaddSubview:imageV]

    [self.window bringSubviewToFront:self.launchView]

//可以设置启动页的存在时间

    [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(removeLun) userInfo:nil repeats:NO]

}

-(void)removeLun

{

    [self.launchView removeFromSuperview]

}

1、设置value为pxx的项选中

$(".selector").val("pxx")

2、设置text为pxx的项选中

$(".selector").find("option[text='pxx']").attr("selected",true)

这里有一个中括号的用法,中括号里的等号的前面是属性名称,不用加引号。很多时候,中括号的运用可以使得逻辑变得很简单。

3、获取当前选中项的value

$(".selector").val()

4、获取当前选中项的text


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/11107997.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-13
下一篇 2023-05-13

发表评论

登录后才能评论

评论列表(0条)

保存