- 博客(34)
- 收藏
- 关注
原创 Swift闭包和函数
///定义两个参数函数func age(age1:Int,age2:Int)->Int{ if(age1>age2){ return age1; }else{ return age2; } }//闭包var eat={ (a:Int,b:Int)->Int in return a+b;}...
2018-11-30 10:44:16 336
原创 Swif中的感叹号和问好以及两个问号的介绍
首先介绍一下swift 中的 Optional!点到 Optional 的头文件可以看到, Optional 其实是个enum,里面有 case None 和 case Some(Wrapped)两种类型。其实所谓None 就是 nil, Some 就是 非nil, 是要进行包装的.这也是使用Optional的时候要拆包(从enum里取出来原始值)的原因!一般"?"含有 可选,试一试,的意思...
2018-11-28 19:57:42 257
原创 用Swift创建表格
1.创建可变数组,和表格//创建可变数组 var ar:[NSString]=["你是","电脑","得的","爸爸"] //创建表格 var tab:UITableView?2.添加override func viewDidLoad() { super.viewDidLoad() //创建表格 self.tab=UIT...
2018-11-27 20:49:47 383
原创 xib注册
注册[self.tbv registerNib:[UINib nibWithNibName:@"BGTableViewCell" bundle:nil] forCellReuseIdentifier:@"cell"];调用方法- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIn...
2018-11-22 20:25:09 641
原创 视频播放1
1.需要调用AVPlayerViewController自带播放器必须导入两个数据库#import <AVKit/AVKit.h>#import <AVFoundation/AVFoundation.h>2.获取本地影用NSStringNSString *file=[[NSBundle mainBundle]pathForResource:@".mp4" ofTy...
2018-11-20 14:13:44 120
原创 分段控制器view隐藏
-(void)dj:(UISegmentedControl *)segment{ if(segment.selectedSegmentIndex==0){ self.view.backgroundColor = [UIColor whiteColor]; collV.hidden = NO; }else if(s...
2018-11-20 11:43:11 124
原创 plist 文件 解析页眉图片
//页眉-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{UIView *headerView=[[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width,...
2018-11-16 16:39:33 100
原创 播放View 点击判断
//创建底部view-(void)SV{ // 设置底部view UIView *view1 = [[UIView alloc]initWithFrame:CGRectMake(0, self.view.frame.size.height-60, self.view.frame.size.width, 60)]; // 设置颜色 view1.backgroundC...
2018-11-16 15:48:48 110
原创 IOS plist文件内容获取本地内容方法
//获取plist文件 NSURL *URL=[[NSBundle mainBundle]URLForResource:@"Property List" withExtension:@"plist"]; //plist 文件为字典类型 NSDictionary *dic=[NSDictionary dictionaryWithContentsOfURL:URL];...
2018-11-16 11:48:15 1890
原创 tabbar图片位置大小修改
vc.tabBarItem.imageInsets = UIEdgeInsetsMake(8, 0, -8, 0);
2018-11-16 11:45:54 3321
原创 本地音频播放
1.导入本地音乐到xcode文件中2.v.m中加入音频播放框架#import <AVFoundation/AVFoundation.h> //音频视频框架3.写属性给音频播放器@property(nonatomic,strong)AVAudioPlayer *player;4.写3个按钮(1):播放按钮(2):停止按钮(3):结束按钮// 播放音乐按钮 U...
2018-11-15 11:04:51 449
原创 自定义网格步奏
1.创建继承CollectionViewCell的文件为:CECollectionViewCell2.在CE.h中写入属性@property (nonatomic, strong) UIImageView *imgView; // 图片@property (nonatomic, strong) UILabel *label; // 内容3.在CE.m中写入自定义-(instance...
2018-11-14 16:04:55 158
原创 视频播放
1.导入视频到项目中2.导入数据库#import <AVKit/AVKit.h>//.m写入<AVKit/AVKit.h>可以写入控件按钮什么的#import <AVFoundation/AVFoundation.h>///系统播放库3.//获取本地资源 NSString *file=[[NSBundle mainBundle]pathForResou...
2018-11-14 11:59:49 113
原创 iPhone X 适配
// iPhoneX适配#define Is_Iphone (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)#define Is_Iphone_X (Is_Iphone && kScreenHeight == 812.0)// 状态栏高度#define kStatusHeight (Is_Iphone_X ? ...
2018-11-13 16:24:25 152
原创 分区数组解析
//分区 self.array = [NSMutableArray new]; //z数组 self.titleArray = [NSMutableArray new]; AFHTTPSessionManager * manager = [AFHTTPSessionManager manager]; manager.responseSerializer =...
2018-11-13 11:54:01 162
原创 文本提示可以改颜色的代码
//提示文字颜色 _text2.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"填写手6位以上的数字"attributes:@{NSForegroundColorAttributeName: [UIColor lightGrayColor]}];...
2018-11-12 16:02:06 545
原创 默认为关闭大标题模式
// 默认为关闭大标题模式 self.navigationController.navigationBar.prefersLargeTitles = YES; self.title = @"健康";
2018-11-12 14:47:19 101
原创 AFNetting MJExtension.h 解析
1.coco 导入pod ‘AFNetworking’pod ‘MJExtension’2.M中创建继承NSObject 文件为MD在M.h中写属性@property (nonatomic, copy) NSString * img;@property (nonatomic, copy) NSString * Ztext;@property (nonatomic, copy) NSS...
2018-11-09 19:17:04 155
原创 下拉刷新,上拉删除表格
popo继承pod ‘MJRefresh’v.h@property (nonatomic , assign)int page;v.m#import "ViewController.h"#import <MJRefresh.h>@interface ViewController ()<UITableViewDelegate,UITableViewDataSource&...
2018-11-09 11:37:05 157
原创 网络请求
-(void)loadData{ //开始网络请求 AFHTTPSessionManager *manager =[AFHTTPSessionManager manager]; //默认请求类型 manager.responseSerializer=[AFHTTPResponseSerializer serializer]; //GET方法 [man...
2018-11-07 11:55:46 124
原创 自定义下拉菜单
1.BOLL@interface oneViewController ()@property(nonatomic,strong)UIView *view1;@property(nonatomic,strong)UIImageView *img;@property(nonatomic,strong)UIButton *btn;@endBOOL an;@implementation o...
2018-11-06 13:50:58 320
原创 下拉菜单加跳转
1.导入文件WTKDropView2…m导入头文件和跳转文件#import "WTKDropView.h"#import "tzViewController.h"#define WS(weakSelf) __weak __typeof(&*self)weakSelf = self;3.写属性@property (nonatomic,strong)WTKDropView ...
2018-11-06 11:55:06 216
原创 iOS 菜单 PopMenu
1.CocoaPods 集成pod ‘PopMenu’2.v.mNSMutableArray *items = [[NSMutableArray alloc] initWithCapacity:3];MenuItem *menuItem = [[MenuItem alloc] initWithTitle:@"Flickr" iconName:@"post_type_bubble_flickr...
2018-11-06 10:58:19 916
原创 DOM解析
1.导入文件夹DOM解析类第三方包2.创建model文件继承与NSObject3.model.h中写入属性@property (nonatomic,strong)NSString *name,*age,*sex;4.APP.m中写入导航#import "AppDelegate.h"#import "ViewController.h"@interface AppDelegate ()...
2018-11-06 09:22:08 116
原创 SAX解析
1.创建Student 继承NSObject2.在Student.h中写入属性@property(nonatomic,strong)NSString *name,*age,*sex;3.A.m中写入导航#import "AppDelegate.h"#import "ViewController.h"@interface AppDelegate ()@end@implemen...
2018-11-06 09:16:26 105
原创 底部弹窗
1.V.M- (void)viewDidLoad { [super viewDidLoad]; //设置背景色 self.view.backgroundColor = [UIColor yellowColor]; //弹出按钮 UIButton *alertBt = [UIButton buttonWithType:UIButtonTypeSystem];...
2018-11-05 16:42:54 223
原创 下拉菜单
1.导入coco pod ‘MLMenu’2.V.m中写头文件#import <MLMenu/MLMenuView.h>#define MLClolor(r,g,b,a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]#define k_ScreenHeight [UIScreen...
2018-11-05 14:27:26 124
原创 网格跳转+刷新
1.coco继承刷新控件pod ‘MJRefresh’2.v.h@property(nonatomic , assign)int *Page;3.v.m#import "ViewController.h"#import "t1ViewController.h"#import "t2ViewController.h"#import "t3ViewController.h"#imp...
2018-11-03 11:15:43 108
原创 上拉刷新
1.coco继承pod ‘MJRefresh’2.v.h中写入@property(nonatomic , assign)int *Page;3.v.m中导入头文件#import <MJRefresh.h>4.写入属性@property(nonatomic,strong)NSMutableArray * dataSource;- (void)viewDidLoad { ...
2018-11-03 11:04:31 89
原创 网格进行跳转
//点击网格进行跳转-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{ if(indexPath.row==0){ NSLog(@"点击了1!"); t1ViewController *t1=[...
2018-11-03 09:51:17 208
原创 分区文字判断
// 设置分区头部文字- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { UIView *view = [[UIView alloc] init]; UILabel *lab = [[UILabel alloc] initWithF...
2018-11-03 08:50:15 102
原创 网格
//// ViewController.m// 222//// Created by 三哥哥 on 2018/11/1.// Copyright © 2018年 三哥哥. All rights reserved.//#import “ViewController.h”@interface ViewController ()<UITableViewDataSource,...
2018-11-02 16:27:29 171
原创 新闻视频部分
1.创建M V C文件2.在M文件中创建继承NSObject的文件为VIdeoModel3.在VIdeoModel.h中写属性@property(nonatomic,copy)NSString *replyCount;//跟贴@property(nonatomic,copy)NSString *cover;//图片@property(nonatomic,copy)NSString *...
2018-11-02 14:31:56 115
原创 导航标题颜色和字体更改
self.navigationItem.title=@"数码科技"; self.navigationController.navigationBar.titleTextAttributes=@{NSForegroundColorAttributeName:[UIColor whiteColor],NSFontAttributeName:[UIFont systemFontOfSize:16]...
2018-11-01 14:02:18 325
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人