- 博客(85)
- 收藏
- 关注
原创 swift 解决tableView点击上窜的问题
自动计算cell高度,当点击选择的时候,tableView会上窜,给Estimate 一个大概默认值就ok了。
2019-09-16 16:53:03
300
原创 swift 显示网络图片
let url = model?.photovar imageUrl: URL?if let string = url, let urlString = string.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) { imageUrl = URL(string: urlString)}self.phot...
2019-09-12 17:22:28
1173
原创 swift 字符串的处理(map)
let timeText = "2019-10-10 00:00:00,2019-10-10 00:00:00|2019-10-10 00:00:00,2019-10-10 00:00:00"let mapBlock: ([String]) -> (String) = { (list) -> String in var startTimeString = list.firs...
2019-09-12 13:47:06
910
原创 swift 关于时间转换
let timeFormater = DateFormatter() timeFormater.dateFormat = "yyyy-MM-dd HH:mm:ss" if let timeDate = timeFormater.date(from: model.createTime!) { t...
2019-09-11 20:04:55
380
原创 Swift textView输入提示和字数限制以及剩余字数显示
// MARK: - UITextViewDelegate func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { if text.isEmpty == true && range...
2019-07-26 11:16:41
2385
原创 Mac appium-python自动化测试----环境配置
背景:Mac mini:10.14.4xcode:10.2.1VScode:1.34.0(python的编译器,也可以用别的)准备阶段:1、下载安装python下载最新版本的3.7.3注:mac自带python2.7版本,不用,python2和3语法变化比较大,建议32、下载安装android sdk 、JDKandroid sdk及工具等下载地址:https:...
2019-05-31 14:41:12
446
原创 Mac端-Appium桌面版-iOS真机自动化测试-初尝试
1. 启动appium,版本 1.13.02.点击红框里的,Edit Configurations。3.配置一下ANDROID_HOME,JAVA_HOME我的是这样的,如果你的没有下载,就先去下载(Android sdk)(JAVA):ANDROID_HOME:/Users/yingying.zou/Library/Android/sdkJAVA_HOME:/Lib...
2019-05-31 14:39:30
1471
原创 Mac 通过终端查找appActivity
最近研究用appium-desktop做app 的自动化测试,查找appActivity用到的方法,记录一下。1.创建一个文本,命名为log.tex。2.打开终端,把这个创建的文本拖进来,就可以看到文本的地址,下一步能用到。3.终端输入adb logcat>上一步得到的地址 例如:adb logcat>/Users/yingying.zou/Desktop/lo...
2019-05-24 11:00:02
1752
原创 Swift 隐藏某一页面的返回按钮
self.navigationItem.leftBarButtonItem = nilself.navigationItem.hidesBackButton = true起初,只写第二行没有用,加上第一行,先置空,再隐藏就好了。
2019-04-12 15:16:18
1284
1
原创 Swift 弹出View,加到最上层
func addPdfView(_ sender: String) { let mview = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)) let closedBtn = UIButton(...
2019-04-11 13:21:56
3586
原创 Swift 取数组的前8个放到另一个数组里
//获取数据func setLocalData() { self.showHUD() self.task = FetchManager.share.fetchBrandList( success: { [unowned self] (list) -> (Void) in DispatchQueue.m...
2019-04-01 11:11:21
6392
原创 Swift 读取本地txt文本数据及转换
//读本地 转换成json do catch是抓错 let path = Bundle.main.url(forResource: "productDetailInfo", withExtension: "txt") let data = try! Data(contentsOf: path!) do { let dict = try!...
2019-03-28 10:26:06
3766
原创 Swift WKWebView的url带汉字,页面加载不出来的解决办法
newUrlString = getUrlString?.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed)
2019-03-26 17:11:28
1991
原创 swift获取版本号、获取缓存、清除缓存
// 获取App的版本号 self.version.text = infoDic?["CFBundleShortVersionString"] as? String///获取APP缓存 func getCacheSize()-> String { // 取出cache文件夹目录 let cachePath = NSSearchPathFo...
2019-03-26 15:00:47
692
原创 Swift 如何创建N个按钮,并且控件大小随着获取的文字长度变化
nameList!.forEach { (text) in let attributes = [NSAttributedStringKey.font: UIFont.systemFont(ofSize: 14)] var width = (text.name?.boundingRect(with: ...
2019-03-22 17:58:51
696
原创 Swift 如何移除所有的子视图
自定义cell,如果self.contentView.addSubview(itemButton),再用的时候,一定记得先移除。self.contentView.subviews.forEach {$0.removeFromSuperview()}否则,滑动tableView的时候,重影了。...
2019-03-22 17:54:20
2537
原创 Swift4.2 KVO监听
var observation: NSKeyValueObservation?override func viewDidLoad() {super.viewDidLoad()self.observation = self.downView.observe(\UIView.isHidden, options: [.new]) { (_, change) i...
2019-03-20 10:41:31
400
原创 self.edgesForExtendedLayout=UIRectEdgeBottom;
self.edgesForExtendedLayout=UIRectEdgeBottom;导航栏下面的tableView等的起始位置
2016-07-26 13:21:58
1137
原创 微信支付
#pragma mark- 微信支付- (void)bizPay:(NSDictionary *)dic { NSString *res = [self jumpToBizPay:dic]; if( ![@"" isEqual:res] ){ UIAlertView *alter = [[UIAlertView alloc] initWithTitle:@"支
2016-07-06 17:22:33
594
原创 cell上按钮的点击事件
.h@property (assign,nonatomic) SEL cancleBtnAction;@property (assign,nonatomic) id target;.m- (void)layoutSubviews{ [super layoutSubviews]; [self.cancleBtn addTarget:self.target action:s
2016-06-14 09:08:41
1720
原创 block传值
B页面typedefvoid (^ReturnTextBlock)(NSString *showText);@interface SelectReasonViewController :UIViewController@property (weak,nonatomic) IBOutletUIButton *btn1;@property (
2016-06-13 14:31:52
412
原创 改变导航栏左边按钮的点击区域
UIButton *leftBtn = [UIButton buttonWithType:UIButtonTypeCustom]; leftBtn.frame = CGRectMake(0, 0, 30, 30); [leftBtn setImage:[UIImage imageNamed:@"jiahao"] forState:UIControlStateNormal];
2016-03-10 14:42:17
690
原创 6-16位数字或密码,判断方法。
//设置密码+ (BOOL)isPassword:(NSString *)key{ NSPredicate *pwdPre = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", @"\\w{6,16}"]; return [pwdPre evaluateWithObject:key]; }
2016-03-07 17:36:34
1514
原创 模态页面跳转到下一页
CreateThemesViewController *creat = [[CreateThemesViewController alloc] init]; UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:creat]; [self presentVie
2016-02-17 14:26:42
385
原创 iOS 大学列表检索
#import "SchoolSelectViewController.h"#import "InfoViewController.h"#import "AsyConnectModel.h"#import "Collect.h"@interface SchoolSelectViewController (){ NSMutableArray *messageArr_; NS
2016-01-26 16:50:36
451
原创 self.tableView.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.3];
设置背景透明,文字不透明的方法。
2016-01-25 17:51:14
856
原创 [[dic objectForKey:@"name"] description]
[[dic objectForKey:@"name"] description]description是为了确保取出来的是字符串类型。龙哥威武~
2016-01-25 17:29:52
869
原创 构造数组结构
- (NSMutableArray *)handleDataFrom:(NSArray *)arr{ NSString *tempString = @""; for (NSDictionary *dic in arr) { NSMutableDictionary *elementDic = [NSMutableDictionary dictionary];
2016-01-25 16:23:12
494
转载 iOS获取键盘高度
最近做了一个自定义键盘,首先是要知道iOS设备各种键盘的高度,下面就来说一下怎么获取键盘的高度。 主要是利用键盘弹出时的通知。 1、首先先随便建一个工程。 2、在工程的 -(void)viewDidload;函数中添加键盘弹出和隐藏的通知,具体代码如下:1234567891011//增加监听,当键盘出现或改变时收出消息[[NSNotificationC
2015-12-23 12:08:10
970
原创 UILabel行高设置
_contentLabel.frame = CGRectMake(8, 136, SCREEN_WIDTH - 16, 1); _contentLabel.numberOfLines = 0; _contentLabel.text = [Collect replaceNull:[_contentDic objectForKey:@"description"]]; NSMut
2015-12-21 18:03:43
1185
原创 不同颜色文字拼接显示
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"距离开课还有%@天",[NSString stringWithFormat:@"%@",[[response objectForKey:@"message"] objectFo
2015-12-21 09:56:06
717
原创 约束
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *lineleadingConstant; _lineleadingConstant.constant = SCREEN_WIDTH/3; [self.view updateConstraintsIfNeeded];
2015-12-17 11:47:53
401
原创 textView输入字数统计
-(void)textViewEditChanged:(NSNotification *)obj{ UITextView *textField = (UITextView *)obj.object; NSString *toBeString = textField.text; [_totalLabel setText:[NSString stringWithFor
2015-10-29 14:13:43
912
原创 蒙板_upView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
//加到window上,由于再加上的view也透明了 所以用以下方法解决self.upView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HIGHT); _upView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
2015-10-21 13:59:04
921
原创 UITableView隐藏多余分割线
self.tableView.tableFooterView = [[UIView alloc]init];
2015-08-04 14:31:02
452
原创 label上显示多样式文字
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HIGHT)]; label.numberOfLines = 0; NSString *htmlString = [Collect replaceNull:[response ob
2015-07-17 10:44:53
1472
原创 模态背景半透明
SelectViewController *select = [[SelectViewController alloc] init]; select.arrStr = @"ALL"; select.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; if ([[UIDevice currentDevice]
2015-07-13 15:28:53
750
原创 数字键盘回收的问题-限制只能数字输入
- (BOOL)textField:(UITextField*)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString*)string{ NSCharacterSet*cs; cs = [[NSCharacterSetcharacterSetWithCharactersIn
2015-07-10 10:29:46
493
原创 刷新和加载
[self.tableView addLegendHeaderWithRefreshingTarget:self refreshingAction:@selector(addHeaderRefreshing)]; [self.tableView.header beginRefreshing]; [self.tableView.footer beginRefreshing];
2015-06-29 13:15:55
1415
原创 自定义cell适配-返回的cell高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ UITableViewCell *cell = [self tableView:tableView cellForRowAtIndexPath:indexPath]; return cell
2015-06-29 13:14:04
577
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人