同一个界面多个子控制器切换视图

2023-10-28

先看示例: 
这里写图片描述 
EssenceViewController为父控制器。 
AllViewController =》全部 
VideoViewController =》视频 
VoiceViewController =》声音 
PictureViewController =》图片 
WordViewController =》段子

一、分析 
1.顶部菜单栏 
大的UIView里包含 一个子UIView(菜单选中的底部指示器)和5个菜单UIButton。 
2.中间内容区域是UIScrollView。点击不同菜单切换子控制器,滚动scrollView也要切换,并且菜单栏也跟着切换。

二、详细看代码

//
//  EssenceViewController.m


#import "EssenceViewController.h"
#import "RecommendTagsViewController.h"
#import "AllViewController.h"
#import "VideoViewController.h"
#import "VoiceViewController.h"
#import "PictureViewController.h"
#import "WordViewController.h"

@interface EssenceViewController ()<UIScrollViewDelegate>
/**
 *  标签底部红色指示器
 */
@property(nonatomic,weak)UIView *indicatorView;
/**
 *  当前选中的顶部标签内部的按钮
 */
@property(nonatomic,weak)UIButton *selectedButton;

/**
 *  顶部所有标签的view
 */
@property(nonatomic,weak)UIView *titlesView;

/**
 *  内容视图
 */
@property(nonatomic,weak)UIScrollView *contentView;

@end

@implementation EssenceViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    // 设置导航栏
    [self setupNav];

    // 初始化所有子控制器
    [self setupChildVces];

    // 设置顶部的标签栏
    [self setupTitlesView];

    // 底部cententView
    [self setupContentView];
}

/**
 *  初始化所有子控制器
 */
- (void)setupChildVces
{
    AllViewController *all = [[AllViewController alloc] init];
    [self addChildViewController:all];

    VideoViewController *video = [[VideoViewController alloc]init];
    [self addChildViewController:video];

    VoiceViewController *voice = [[VoiceViewController alloc] init];
    [self addChildViewController:voice];

    PictureViewController *picture = [[PictureViewController alloc] init];
    [self addChildViewController:picture];

    WordViewController *word = [[WordViewController alloc] init];
    [self addChildViewController:word];
}

/**
 *  底部cententView
 */
- (void)setupContentView
{
    // 不要自动调整inset
    self.automaticallyAdjustsScrollViewInsets = NO;

    UIScrollView *contentView = [[UIScrollView alloc] init];
    contentView.frame = self.view.bounds;
    contentView.delegate = self;
    contentView.pagingEnabled = YES;
    [self.view insertSubview:contentView atIndex:0];
    contentView.contentSize = CGSizeMake(contentView.width * self.childViewControllers.count, 0);
    self.contentView = contentView;

    // 添加第一个控制器的view
    [self scrollViewDidEndScrollingAnimation:contentView];
}

/**
 *  设置顶部的标签栏
 */
- (void)setupTitlesView
{
    // 标签栏整体
    UIView *titlesView = [[UIView alloc] init];
    titlesView.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.7];
    titlesView.width = self.view.width;
    titlesView.height = 35;
    titlesView.y = 64;
    [self.view addSubview:titlesView];
    self.titlesView = titlesView;

    // 底部红色指示器
    UIView *indicatorView = [[UIView alloc] init];
    indicatorView.backgroundColor = [UIColor redColor];
    indicatorView.height = 2;
    indicatorView.tag = -1;
    indicatorView.y = titlesView.height - indicatorView.height;
    self.indicatorView = indicatorView;

    // 内部子标签
    NSArray *titles = @[@"全部 ",@"视频",@"声音",@"图片",@"段子"];
    CGFloat height = titlesView.height;
    CGFloat width = titlesView.width / titles.count;

    for (NSInteger i=0; i<titles.count; i++) {
        UIButton *button = [[UIButton alloc] init];
        button.tag = i;
        button.height = height;
        button.width = width;
        button.x = i * button.width;
        [button setTitle:titles[i] forState:UIControlStateNormal];
        [button layoutIfNeeded]; // 强制布局(强制更新子控件的frame)
        [button setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
        [button setTitleColor:[UIColor redColor] forState:UIControlStateDisabled];
        button.titleLabel.font = [UIFont systemFontOfSize:14];
        [button addTarget:self action:@selector(titleClick:) forControlEvents:UIControlEventTouchUpInside];
        [titlesView addSubview:button];

        // 默认点击了第一个按钮
        if (i == 0) {
            button.enabled = NO;
            self.selectedButton = button;

            // 让按钮内部的label根据文字内容计算尺寸
            [button.titleLabel sizeToFit];
            self.indicatorView.width = button.titleLabel.width;
            self.indicatorView.centerX = button.centerX;
        }
    }

    // indicatorView最后才添加到titlesView里
    // 为了后面从titlesView取button方便
    [titlesView addSubview:indicatorView];
}

/**
 *  点击了标签栏里的按钮
 */
- (void)titleClick:(UIButton *)button
{
    // 修改按钮的状态
    self.selectedButton.enabled = YES;
    button.enabled = NO;
    self.selectedButton = button;

    // 让标签执行动画
    [UIView animateWithDuration:.025 animations:^{
        self.indicatorView.width = self.selectedButton.titleLabel.width;
        self.indicatorView.centerX = self.selectedButton.centerX;
    }];

    // 滚动contentView
    CGPoint offset = self.contentView.contentOffset;
    offset.x = button.tag * self.contentView.width;
    [self.contentView setContentOffset:offset animated:YES];
}

/**
 *  设置导航栏
 */
- (void)setupNav
{
    // 设置导航栏标题
    self.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"MainTitle"]];

    // 设置导航栏左边的按钮
    self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithImage:@"MainTagSubIcon" highImage:@"MainTagSubIconClick" target:self action:@selector(tagButtonClick)];

    // 设置背景色
    self.view.backgroundColor = GlobalBgColor;
}

/**
 *  点击了导航栏左边的按钮
 */
- (void)tagButtonClick
{
    RecommendTagsViewController *vc = [[RecommendTagsViewController alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
}

#pragma mark - <UIScrollViewDelegate>
/**
 *  滚动完毕就会调用(如果不是人为拖拽scrollView导致滚动完毕,才会调用这个方法
 */
- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
{
    // 当前的索引
    NSInteger index = scrollView.contentOffset.x / scrollView.width;

    // 取出子控制器
    UITableViewController *vc = self.childViewControllers[index];
    vc.view.x = scrollView.contentOffset.x;
    vc.view.y = 0; //设置控制器view的y值为0(默认是20)
    vc.view.height = scrollView.height; //设置控制器view的height值为整个屏幕的高度(默认是比屏幕高度少20)

    // 设置内边距
    CGFloat top = CGRectGetMaxY(self.titlesView.frame);
    CGFloat bottom = self.tabBarController.tabBar.height;
    vc.tableView.contentInset = UIEdgeInsetsMake(top, 0, bottom, 0);
    // 设置滚动条的内边距
    vc.tableView.scrollIndicatorInsets = vc.tableView.contentInset;
    [scrollView addSubview:vc.view];
}

/**
 *  在scrollview停止滑动的时候执行
 */
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
    [self scrollViewDidEndScrollingAnimation:scrollView];

    // 点击菜单按钮
    NSInteger index = scrollView.contentOffset.x / scrollView.width;
    [self titleClick:self.titlesView.subviews[index]];
}
@end
   
   
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233

三、其他 
上面代码还用到一个UIView分类:

//
//  UIView+Extension.h

//  封装frame的修改

#import <UIKit/UIKit.h>

@interface UIView (Extension)

@property(nonatomic,assign)CGSize size;
@property(nonatomic,assign)CGFloat width;
@property(nonatomic,assign)CGFloat height;
@property(nonatomic,assign)CGFloat x;
@property(nonatomic,assign)CGFloat y;
@property(nonatomic,assign)CGFloat centerX;
@property(nonatomic,assign)CGFloat centerY;
/*
 在分类中声明@property,只会生成方法的声明,不会生成方法的实现和带有_下划线的成员变量
 */
@end
   
   
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
//
//  UIView+Extension.m


#import "UIView+Extension.h"

@implementation UIView (Extension)

- (void)setSize:(CGSize)size {
    CGRect frame = self.frame;
    frame.size = size;
    self.frame = frame;
}
- (CGSize)size {
    return self.frame.size;
}

- (void)setWidth:(CGFloat)width {
    CGRect frame = self.frame;
    frame.size.width = width;
    self.frame = frame;
}
- (CGFloat)width {
    return  self.frame.size.width;
}

- (void)setHeight:(CGFloat)height {
    CGRect frame = self.frame;
    frame.size.height = height;
    self.frame = frame;
}
- (CGFloat)height {
    return self.frame.size.height;
}

- (void)setX:(CGFloat)x {
    CGRect frame = self.frame;
    frame.origin.x = x;
    self.frame = frame;
}
- (CGFloat)x {
    return self.frame.origin.x;
}

- (void)setY:(CGFloat)y {
    CGRect frame = self.frame;
    frame.origin.y = y;
    self.frame = frame;
}
- (CGFloat)y {
    return  self.frame.origin.y;
}

- (void)setCenterX:(CGFloat)centerX
{
    CGPoint center = self.center;
    center.x = centerX;
    self.center = center;
}

- (CGFloat)centerX
{
    return self.center.x;
}

- (void)setCenterY:(CGFloat)centerY
{
    CGPoint center = self.center;
    center.y = centerY;
    self.center = center;
}

- (CGFloat)centerY
{
    return self.center.y;
}
@end
   
   
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77


from: http://blog.csdn.net/github_26672553/article/details/51888923


本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

同一个界面多个子控制器切换视图 的相关文章

  • 如何在 SceneKit 中以编程方式将 png 纹理包裹在立方体周围

    我是 SceneKit 的新手 试图让一些基本的东西工作 但到目前为止还没有取得多大成功 由于某种原因 当我尝试将 png 纹理应用于 CNBox 时 我最终除了黑色之外什么也没有 这是我在 viewDidLoad 中的简单代码片段 let
  • TestFlight Beta 中的消息不可用

    I am seeing Unavailable message in TestFLight Beta App in iOS8 Please find the attached screenshot please tell me how to
  • iOS 上 Safari 中的 shift 键

    有没有办法在javascript中判断手机键盘上是否按下了shift键 并将其与大写锁定 按两次shift键 区分开来 一些事实 首先 让我们看一下有关 iOS 键盘的一些事实 我假设您已经知道了 当您进入键盘模式时 shift键始终处于激
  • 更改目录时 Gitlab CI 运行程序作业失败退出状态 1

    我正在使用我的个人机器作为使用 Fastlane 的 iOS 项目的运行程序 这主要是因为共享运行器没有为 iOS 设置 因为它们没有安装 Xcode 更改目录时我的作业立即失败 它是一个 shell 运行程序 根本没有其他自定义配置 有什
  • Swift:Tableview 在导航栏下方滚动但在状态栏上方滚动?

    我使用以下技巧隐藏了导航栏的阴影 self navigationController navigationBar setBackgroundImage UIImage for default self navigationControlle
  • iPhone 的翻译器?

    我对为 iPhone 制作一个解释器很感兴趣 这将是一个实验性的想法 但可能会很棒 我喜欢让我自 己的语言适合移动计算和数学的想法 我查阅了很多资料 发现有关 iPhone 上的口译员的信息很复杂 苹果会允许什么 我见过这个应用程序 这是一
  • 从字典创建 Swift 对象

    如何根据 Swift 字典中的查找值动态实例化类型 希望这对其他人有用 我们需要进行一些研究才能弄清楚这一点 目标是避免巨大的 if 或 switch 语句从值创建每个对象类型的反模式 class NamedItem CustomStrin
  • 按升序对 NSDictionary 进行排序

    我正在尝试排序NSDictionary按升序排列 我正在使用这段代码 NSDictionary valDict self mGetDataDict key rowKey for NSString valueKey in valDict al
  • iOS - 在相机上放置自定义叠加层(垂直对齐)。顶部黑条的大小

    我正在寻找以下问题的编程解决方案 我想在相机 iOS 上绘制自定义叠加层 我希望它位于相机输出视图的垂直中央 我已经完成了相对于屏幕而不是相机图片居中绘制自定义视图 为此 我需要获得顶部黑条的大小 我怎么才能得到它 顶部和底部栏的大小不相等
  • 使用javascript以编程方式触发iOS safari中的复制菜单?

    我正在尝试实现一种用户友好的方式 将一些文本从文本输入字段复制到 iOS Safari 上的剪贴板 我知道无法在这个平台上以编程方式完成此操作 但我希望能够尽可能地指导用户体验 在 iOS Safari 上 当用户手动突出显示某些文本时 会
  • iOS绘图3D图形库[关闭]

    Closed 这个问题不符合堆栈溢出指南 help closed questions 目前不接受答案 我正在搜索一个可以帮助我绘制 3D 图表的库 我想要类似的东西这一页 http www math uri edu bkaskosz fla
  • UITableViewCell 内嵌套 UIStackView 内的 UILabel 有时会被截断

    我的一个表设置中有一个表视图单元格 其中包含以下视图层次结构 外部水平 stackview 固定到单元格内容视图的尾部 前部 底部和顶部边缘 右侧标签固定到其父 stackViewHackView 的尾部 前部 底部和顶部边缘 在我的控制器
  • 使用未声明的类型“对象”

    这太奇怪了 通常我可以理解未声明的类 但这是声称 Object 类本身未声明 NSObject 可以工作 但我的项目设置方式我需要它是一个纯 Swift 对象 我的类标题如下所示 import UIKit import Foundation
  • 找不到 Cocoa/Cocoa.h 文件

    我在用XMPPFramework在我的应用程序中 我已将 Cocoa Cocoa h 导入到我的 m 文件中 但是当我构建项目时Xcode显示错误 错误 未找到 Cocoa Cocoa h 文件 我该如何解决这个错误 如果您正在为 iOS
  • 如何从第二个视图弹回到根视图?

    我使用 2 将 3 个视图 根视图 第 1 个视图 第 2 个视图 连接在一起modal在 Apple Watch 故事板中继续 1 在根视图中 按下 保存 按钮后 将显示第一个模态视图 2 在第一模态视图中 一旦按下 500 按钮 将显示
  • 隐藏 UITableview 单元格

    我正在尝试从 UITableView 中隐藏单元格 就像删除操作一样 但我只想隐藏它以便稍后在相同位置显示它 我知道 UITableViewCell 有一个名为 隐藏 的属性 但是当我使用此属性隐藏单元格时 它会隐藏但没有动画 并且会留下空
  • 带有自定义字体的 UILabel 错误呈现

    在我的 iPhone 应用程序中 我为所有 UILabel 设置了自定义字体 更准确地说 我对 UILabel 进行了子类化 重写了一个方法 在该方法中设置了自定义字体 然后将 IB 中的所有标签设置为该自定义类 现在的问题是 所有文本都渲
  • 具有隐式授权的 OAuth 应用程序中的客户端模拟

    来自 OAuth 草案 隐式section https datatracker ietf org doc html draft ietf oauth v2 31 section 1 3 2 在隐式授权流程期间发出访问令牌时 授权服务器不对客
  • iOS 目标 c 中的 AES/CBC/PKCS5Padding 结果与 Android 不同

    我在 Android 应用程序中使用 AES CBC PKCS5Padding 代码就像 private static String TRANSFORMATION AES CBC PKCS5Padding private static St
  • iOS 中是否需要 Google App Indexing SDK 才能使用 Google DeepLinking?

    我想用谷歌应用程序索引与我的网页和 iOS 应用程序 我支持通用链接 or 深层链接用谷歌术语 与苹果Search并相应地设置我的网页 From 谷歌文档 https developers google com app indexing i

随机推荐

  • 国内可用的ChatGPT以及ChatGPT的工作流程(一文读懂ChatGPT)

    ChatGPT 介绍 国内可用的CHatGPT ChatGPT的工作流程 介绍 ChatGPT是由OpenAI公司开发的一种用于自然语言处理的语言模型 它是OpenAI旗下的GPT系列 Generative Pre trained Tran
  • 微信小程序用户登录功能无法使用

    背景 一个半年前的小程序项目了 最近一个用我项目的朋友说用户登录功能不能用了 小程序端 后端都没有报错 只有我开发时留下的 信息提示 我第一个反应就是微信小程序在今年三月份更新的接口 wx getUserProfile 但我都把方法改好了呀
  • git删除远程文件夹或文件

    1 操作一 预览将要删除的文件 如果不清楚该目录下是否存在不应该删除的文件 加上 n 这个参数 执行命令时 是不会删除任何文件 而是展示此命令要删除的文件列表预览 1 git rm r n cached 文件 文件夹名称 2 确定无误后删除
  • VGGNet简介及VGG13实现cifar100分类

    目录 VGGNet简介 VGGNet简介 VGG的创新之处 VGG的缺点 VGG13实现cifar100分类 cifar100 tensorflow实现VGG13 VGGNet简介 VGGNet简介 VGGNet由牛津大学计算机视觉组合和G
  • 2023电工杯数学建模B题思路分析

    文章目录 0 赛题思路 1 竞赛信息 2 竞赛时间 3 组织机构 4 建模常见问题类型 4 1 分类问题 4 2 优化问题 4 3 预测问题 4 4 评价问题 0 赛题思路 赛题出来以后第一时间在CSDN分享 1 竞赛信息 中国电机工程学会
  • NOIP中的数学--第8课 容斥原理(一)

    小学数学知识 容斥原理 容斥原理的题目都可以借助韦恩图这一工具来解决 并且非常快速与准确 一 关于两个集合的容斥原理 集合 A 与B 的并集的元素个数 等于集合 A 的元素个数与集合B 的元素个数的和 减去集合A 与 B 的交的元素个数 即
  • nn.AvgPool2d——二维平均池化操作

    PyTorch学习笔记 nn AvgPool2d 二维平均池化操作 torch nn AvgPool2d kernel size stride None padding 0 ceil mode False count include pad
  • 常见合并两个数组的方法

    数组合并方法 concat concat 方法合并数组不改变原数组 let arr1 1 3 4 5 let arr2 1 4 6 7 let result arr1 concat arr2 console log result 1 3 4
  • set实现返回小于给定值的数的个数

    使用pbds平衡树实现 头文件代码如下 for policy based data structures include
  • zookeeper报错Java Home Is Not Set

    安装zookeeper在网站上下载 https zookeeper apache org releases html 解压放在目录D bigdata 本文所用的目录 下 关于zookeeper以及kafka的目录 路径中最好不要出现空格 比
  • 机器学习之朴素贝叶斯方法(Naive Bayes)原理和实现

    目录 一 贝叶斯理论 二 实战朴素贝叶斯 实战朴素贝叶斯1 实战朴素贝叶斯3 三 scikit learn中朴素贝叶斯的分类算法的适用 四 贝叶斯算法的优缺点 一 贝叶斯理论 贝叶斯模型 现在我们来看一下怎么操作 假设我有m个样本数据 这大
  • Nginx(6)安装模块

    1 下载并解压第三方模块 要与nginx版本一致 下载原nginx源码包并解压 2 产看原nginx 编译参数 nginx V 3 进入到解压的nginx源码包目录里重新编译 configure help可以查看所有所需模块对应的编译选项
  • java中正则表达式的基本使用

    正则表达式的常用语法 正则在线检验 http tool chinaz com regex 更多地语法可以参考jdk api中的Pattern类 http tool oschina net apidocs apidoc api jdk zh
  • 传导骚扰的一些其他总结

    传导骚扰测试分类 实际上涉及到一款产品时 这个测试需要测哪些物理量 然后需要用到哪些设备 做骚扰测试 不管你是RE 辐射骚扰 还是CE 传导骚扰 核心的设备还是EMI测试接收机 或者是频谱仪 这两种机器测的是我受平端口的内心和外兜底里的电压
  • [Windows] bat查看端口占用命令, 并且关闭对应进程

    找到进程ID netstat ano find 8080 关闭进程 taskkill PID 13340 F
  • Centos7安装Rabbitmq

    一 下载安装包 RabbitMq需要erlang配合 所以需要安装Rabbitmq server和erlang wget http www rabbitmq com releases rabbitmq server v3 5 0 rabbi
  • CVPR 2023

    点击下方卡片 关注 CVer 公众号 AI CV重磅干货 第一时间送达 点击进入 gt 计算机视觉 微信技术交流群 转载自 CSIG文档图像分析与识别专委会 本文简要介绍CVPR 2023录用论文 Turning a CLIP Model
  • JavaWeb基础2——JDBC

    导航 黑马Java笔记 踩坑汇总 JavaSE JavaWeb SSM SpringBoot 瑞吉外卖 SpringCloud SpringCloudAlibaba 黑马旅游 谷粒商城 目录 一 JDBC 1 1 JDBC概述 1 1 1
  • unity编程实践-制作血条

    作业要求 血条 Health Bar 的预制设计 具体要求如下 分别使用 IMGUI 和 UGUI 实现 使用 UGUI 血条是游戏对象的一个子元素 任何时候需要面对主摄像机 分析两种实现的优缺点 给出预制的使用方法 部署工作 IMGUI
  • 同一个界面多个子控制器切换视图

    先看示例 EssenceViewController为父控制器 AllViewController 全部 VideoViewController 视频 VoiceViewController 声音 PictureViewController