美文网首页
iOS 15相关改动

iOS 15相关改动

作者: woniu | 来源:发表于2023-06-06 11:50 被阅读0次

一、导航栏设置

1、导航栏背景颜色

在iOS 13及以上版本中,使用UINavigationBarAppearance类来设置导航栏的样式,而不再使用UINavigationBar的属性。因此,我们需要将样式赋值给navigationBar的standardAppearance和scrollEdgeAppearance属性,以确保导航栏在不同状态下都能够显示正确的样式

// 导航栏背景颜色
UIColor *navBarBgColor = [UIColor colorWithHexString:@"#F6F8FA"];
if (@available(iOS 15.0, *)) {
    UINavigationBarAppearance *apperance = [[UINavigationBarAppearance alloc] init];
    apperance.backgroundColor = navBarBgColor;
    self.navigationBar.standardAppearance = apperance;
    self.navigationBar.scrollEdgeAppearance = apperance;
} else {
    self.navigationBar.barTintColor = navBarBgColor;
}

2、导航栏文本样式

之所以适配版本是15,是因为在iOS 13UINavigationBar新增了scrollEdgeAppearance属性,但在iOS 14及更早的版本中此属性只应用在大标题导航栏上。在iOS 15中此属性适用于所有导航栏。

// 导航栏标题文本样式
NSDictionary *titleStyle = @{
    NSForegroundColorAttributeName: [UIColor blackColor],
    NSFontAttributeName: [UIFont fontWithName:FontMedium size:19]
};
if (@available(iOS 15.0, *)) {
    UINavigationBarAppearance *apperance = [[UINavigationBarAppearance alloc]init];
    [apperance setTitleTextAttributes: titleStyle];
    self.navigationBar.standardAppearance = apperance;
    self.navigationBar.scrollEdgeAppearance = apperance;
} else {
    self.navigationBar.titleTextAttributes = titleStyle;
}
``

####3、导航栏控件颜色:
self.navigationBar.tintColor = UIColor.redColor;

二、Tabbar按钮动效
通过tabBar: didSelectItem:代理方法接收每次点击的item,对每个item都绑定动画效果,获取到的是item里面的UITabBarSwappableImageView图片对象。

-(void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item{

}

// 添加tabbar点击动画
- (void)animationWithIndex:(NSInteger) index {
    NSMutableArray * tabbarbuttonArray = [NSMutableArray array];
    for (UIView *tabBarButton in self.customTabBar.subviews) {
        if ([tabBarButton isKindOfClass:NSClassFromString(@"TYTGCarTabButton")]) {
            [tabbarbuttonArray addObject:tabBarButton];
        }
    }
    CABasicAnimation*pulse = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
    pulse.timingFunction= [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    pulse.duration = 0.2;
    pulse.repeatCount= 1;
    pulse.autoreverses= YES;
    pulse.fromValue= [NSNumber numberWithFloat:0.9];
    pulse.toValue= [NSNumber numberWithFloat:1.1];
    UIView *TabBarButton = tabbarbuttonArray[index];
    [TabBarButton.layer addAnimation:pulse forKey:nil];
}

具体方案:https://www.codenong.com/jsbfa4ac38eadd/

相关文章

  • 适配 iOS15

    1,UINavigationBar、UIToolbar 和 UITabBar 相关属性背景设置: 从 iOS 15...

  • iOS 15 适配踩坑:NavigationBar、UITabB

    苹果前两天推出了iOS 15。秋天都等不及~~ 相关链接:ios 15.0 适配问题:NavigationBar和...

  • iOS 10 改动

    iOS 10 关闭了App对设置中的跳转 ,只能跳转到本App的设置中

  • iOS动态轮播滚动的实现

    适用人群:iOS开发人员。本文内容:实现消息的竖直方向循环轮播。读者也可以做相关改动,实现常用的图片左右轮播。 备...

  • 记录springboot从1.5.10升级到2.0.0过程中遇到

    写在前面 上一篇系列文章写的是springboot相关的改动, 这边主要是针对cloud相关组件的改动, Spri...

  • iOS 15 适配

    一年一系统,一年一适配。今天我们来讲一下iOS15适配的相关地方。导航栏适配iOS 15中,导航栏的问题比较明显,...

  • iOS15适配相关

    1、tabbar相关 UITabBarAppearance *appearance = [[UITabBarApp...

  • iOS开发 Xcode8中遇到的问题及改动

    新版本发布总会有很多坑,也会有很多改动。一个一个填吧。。。 一、遇到的问题 1、权限以及相关设置 iOS10系统下...

  • iOS10一些frameWork 的改动

    iOS 10 额外的 Framework 改动(部分) AVFoundation 摄像头捕捉 AVFoundati...

  • 4.22 聊手机的UI风格

    心心念念的iOS15终于更新了,果断下载,看了一下效果。 虽然整体上没有改变太多,但是细节上的改动还是让人眼前一亮...

网友评论

      本文标题:iOS 15相关改动

      本文链接:https://www.haomeiwen.com/subject/lelgedtx.html