- 博客(163)
- 收藏
- 关注
原创 ios 传值方法
一丶单利传值1.创建继承NSObject的Single文件.h中//通过类方法创建单利对象+(instancetype)sharedInstance;//创建字符串 存值拿值@property (nonatomic,strong) NSString *Zhi;.m+(instancetype)sharedInstance{ //通过静态变量的方式创建变量 ...
2019-12-07 19:14:07
220
原创 ios 通知传值
1.//字典参数 NSDictionary *dataDic = [NSDictionary dictionaryWithObject:self.chepaihao forKey:@"chename"]; //创建通知 [[NSNotificationCenter defaultCenter] postNotificationName:@"infoNotification...
2019-08-21 10:13:25
357
原创 ios 分区套对应表格
#import "ViewController.h"@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>@property(nonatomic,strong) UITableView * tableView;@property(nonatomic,strong) NSMutableArr...
2019-08-01 17:40:25
253
原创 ios IQK键盘X以上导航白色的问题解决
第一步:IQKeyboardManager.m中进入#import “IQUIView+Hierarchy.h”第二步:找到以下代码替换掉-(UIViewController *)topMostController{ UIViewController *rootController = [UIApplication sharedApplication].keyWindow....
2019-07-25 16:12:20
576
原创 ios 计算偏移量
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{ NSLog(@"scrollViewDidScroll"); CGPoint point=scrollView.contentOffset; NSLog(@"%f,%f",point.x,point.y); if(point.y>81.000000)...
2019-07-16 10:25:30
594
原创 ios 复用框选中无选中状态
-(void)checkboxClick:(UIButton *)btn{ btn.selected = !btn.selected;}- (void)viewDidLoad {UIButton *checkbox = [UIButton buttonWithType:UIButtonTypeCustom]; CGRect checkboxRect = CGR...
2019-07-08 14:26:38
170
原创 ios 调用后台数据三级城市选择器
//// ViewController.m// 地区选择器//// Created by 三哥哥 on 2019/6/6.// Copyright © 2019 三哥哥. All rights reserved.//#import "ViewController.h"#import "Masonry.h"#import "AFNetworking.h"#import ...
2019-06-12 14:25:41
444
原创 ios字符串转换json数据传给后台
//第二种方法,是直接组合json形式的字符串。此种方法,对于对参数的顺序有特殊要求的比较适用。否则,看起来有点繁琐。 NSString *jsonStringOther=[NSString stringWithFormat:@"{\"name\":\"%@\", \"sex\":\"女\", \"age\":\"20\" }",@"李华"]; NSLog(@"-----json...
2019-06-12 09:53:58
1898
原创 ios 图片上传与截取后台返回的\"
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ if(indexPath.row==0){ // 创建UIImagePickerController实例 UIImagePickerController *imagePicke...
2019-06-10 11:24:15
204
原创 ios 获取IP地址
引入文件#import <ifaddrs.h>#import <arpa/inet.h>获取ip地址-(void)getIPaddress{ NSString *address = @"error"; struct ifaddrs * ifaddress = NULL; struct ifaddrs * temp_address = N...
2019-06-04 10:53:42
737
原创 ios 监听TextView输入文本长度
self.textView =[ [UITextView alloc]init]; self.textView.backgroundColor=hs self.textView.delegate = self; self.textView.layer.borderWidth = 1.0;//边宽 ...
2019-05-31 17:25:41
2670
原创 ios 点击按钮文本框暗 明文切换
#pragma mark 点击眼睛了-(void)YanJing:(UIButton *)sender{// sender.selected = !sender.selected; if (sender.tag==0) { // 按下去了就是暗文 NSString *tempPwdStr = self.SuccessText.text; self....
2019-05-31 10:35:54
373
原创 ios 渐变背景颜色
#define RGBA(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]#define MainColor1 RGBA(72, 137, 219, 0.8)//主题橘色1#define MainColor2 R...
2019-05-28 14:34:12
711
原创 ios lable边框+导航左边返回按钮颜色更改
颜色改变[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];边框 cell.scriplabel.layer.borderColor = [UIColor colorWithRed:236.0f/255.0f green:235.0f/255.0f blue:240.0f/255.0f alpha:1].CG...
2019-05-28 14:03:18
249
原创 ios 文本框左边图片+边框样式
//文本框切角+边框颜色和大小 self.tellText.layer.borderWidth=1.0f; self.tellText.layer.masksToBounds=YES; self.tellText.layer.cornerRadius=19; self.tellText.layer.borderColor=[UIColor colorWithRed:...
2019-05-27 17:12:03
291
原创 ios 收回键盘简单
//在viewDidLoad中 添加点击手势,为了关闭键盘的操作UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(viewTapped:)];tap1.cancelsTouchesInView = NO;[self.view addGestur...
2019-05-15 16:36:39
732
原创 ios 循环创建按钮并接口赋值
#define Start_X 5.0f // 第一个按钮的X坐标#define Start_Y 5.0f // 第一个按钮的Y坐标#define Width_Space 5.0f // 2个按钮之间的横间距#define Height_Space 5.0f // 竖间距#define Button_Height 50.0f // 高#define Button_Wid...
2019-05-13 16:04:05
496
原创 ios view触摸方法 + view阴影
UITapGestureRecognizer * zonghe=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(zonghe:)]; [_zongheView addGestureRecognizer:zonghe];
2019-05-10 10:38:33
277
原创 ios 点击表格按钮传值
//targetID 数据源 //[self.targetID addObject:_mm.targetid]; //nhcj.BDID = self.targetID[btn.tag-1]; MyLoadModel *mymodel=self.arrdata[XX.tag];
2019-05-07 18:54:49
198
原创 ios 监听注册通知 移除通知
//通知 NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; //注册通知 [center addObserver:self selector:@selector(textValueChanged:) name:UITextFieldTextDidChangeNotification o...
2019-05-06 18:00:05
5714
原创 ios 表格之间的间隔与阴影
- (void)setFrame:(CGRect)frame{ frame.origin.x += 10; frame.origin.y += 10; frame.size.height -= 10; frame.size.width -= 20; [super setFrame:frame];}
2019-05-05 12:03:14
189
原创 ios 空数据进行判断
相同点: 都是NSObject的比较Class的方法.不同点: isKindOfClass:确定一个对象是否是一个类的成员,或者是派生自该类的成员. isMemberOfClass:确定一个对象是否是当前类的成员. /////// data数据为空当前类if([json[@"data"] isMemberOfClass:[NSNull class]]){...
2019-05-04 22:22:42
505
原创 ios 导航阴影
//导航条添加阴影的效果 self.navigationController.navigationBar.backgroundColor = UIColor.whiteColor; self.tabBarController.tabBar.hidden = YES; self.navigationController.navigationBar.hidden = NO; ...
2019-05-02 22:06:02
131
原创 ios 监听文本内容
#pragma mark 监听文本框内容-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{ _str = [NSMutableString stringWithString:textFiel...
2019-05-02 19:40:13
259
原创 ios 发送验证码
- (void)timeOut{ __block NSInteger timeOut = 60; dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_source_t _Timer = dispatch_source_cr...
2019-05-02 19:16:03
306
原创 ios tabbar另一个方法
#import "ViewController.h"#import "HomeViewController.h"//首页#import "MessageViewController.h"//信息披露#import "LifeViewController.h"//生活#import "MineViewController.h"//我的@interface ViewController...
2019-05-02 14:27:45
199
原创 ios判断是否第一次登录
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {// self.window.rootViewController=[HomeViewController new]; self.isLogin = NO; ...
2019-05-02 14:24:09
541
原创 ios 导航左边修改
//去掉返回按钮上的文字// self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"fanhui"] style:UIBarButtonItemStyleDone target:self action:@selector(back)]; ...
2019-04-30 16:04:19
177
原创 ios 字典套字典
//字典套字典 self.moneyLabel.text=[[json objectForKey:@"data"] objectForKey:@"acctBal"]; self.availableelementLabel.text=[[json objectForKey:@"data"] objectForKey:@"avlBal"]; self....
2019-04-28 10:55:29
749
原创 ios 抓取h5内容
#import "KHViewController.h"#import <WebKit/WebKit.h>#import "WebViewJavascriptBridge.h"static NSString * const URLProtocolHandledKey = @"URLProtocolHandledKey";@interface KHViewControl...
2019-04-27 16:22:03
841
原创 h5返回的data数据进行展示
// // 图片缩放的js代码// NSString *js = @"var count = document.images.length;for (var i = 0; i < count; i++) {var image = document.images[i];image.style.width=320;};window.alert('找到' + count + '张图'...
2019-04-27 10:30:53
547
原创 点击按钮会的你想回去的视图
UINavigationController *navigationVC = self.navigationController; NSMutableArray *viewControllers = [[NSMutableArray alloc] init]; // 遍历导航控制器中的控制器 for (UIViewController *...
2019-04-26 10:40:14
106
原创 post
#import "ViewController.h"@interface ViewController ()@property(nonatomic,strong)NSDictionary *receive; //接收数据@end@implementation ViewController- (void)viewDidLoad { [super viewDidLoad];...
2019-04-25 16:11:28
221
原创 判断机型
//判断是否是ipad#define isPad ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)//判断iPhone4系列#define kiPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSi...
2019-04-23 21:24:13
119
原创 常用宏
#define SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width)#define SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height)// 判断是否为iPhone X 系列 这样写消除了在Xcode10上的警告。#define IPHONE_X \({BOOL ...
2019-04-23 20:35:00
148
原创 ios 关于a视图放在b上面 或b视图放在a下面方法
将一个UIView显示在最前面只需要调用其父视图的 bringSubviewToFront()方法。将一个UIView层推送到背后只需要调用其父视图的 sendSubviewToBack()方法。如:[A bringSubviewToFront:B]; B视图在A视图上面[A sendSubviewToBack:B]; B视图在A视图下面...
2019-04-11 18:58:45
1493
原创 ios 模拟器状态栏操作
//改变状态栏的文字颜色为白色-(UIStatusBarStyle)preferredStatusBarStyle{ return UIStatusBarStyleLightContent;}//隐藏状态栏-(BOOL)prefersStatusBarHidden{ return YES;}
2019-04-11 10:47:31
563
原创 ios点击向上按钮更改头像位置
1.根据frame改位置//获取按钮原始的frame值(包含大小和坐标) CGRect originframe=self.touxiang.frame; //设置y值-10 originframe.origin.y-=100; //1.开启一个动画 [UIView beginAnimations:nil context:nil]; //2...
2019-04-10 09:34:38
155
原创 ios获取各种文件目录的路径
// 获取沙盒主目录路径NSString *homeDir = NSHomeDirectory();// 获取Documents目录路径NSString *docDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];// 获取Library的目录...
2019-04-01 19:31:36
1448
原创 ios模仿刷礼物增加次数动画
#import "ViewController.h"@interface ViewController ()@property (weak, nonatomic) IBOutlet UILabel *comboLabel;@property (nonatomic,assign)NSUInteger danceCount;@end@implementation ViewControl...
2019-04-01 17:28:04
363
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人