tableview默认选中第一行 //默认选中第一行,并执行点击事件 NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; [mytableview selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] animated:YES scrollPosition:UITableViewScrollPositionTop]; if ([mytableview.de...
HomeBrew正确安装姿势 镜像安装脚步:/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"
UITextView修改光标位置 let feedbackTV = UITextView() var orgContainerInset = feedbackTV.textContainerInset orgContainerInset.left = 5; feedbackTV.textContainerInset = orgContainerInset
安装HomeBrew curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to raw.githubuserconten 使用国内源/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
在Xcode编译的时候,报这个错误"library not found for - 分析原因,解决问题:在Xcode编译的时候,可能会遇到报这个错误"library not found for - ",这是为什么呢?由于我们在项目中使用了一些第三方的库,如百度的静态库。当Xcode在编译的时候却找不到这个库,所以我们要让Xcode知道这个库文件在哪里,这样在编译的时候就可以轻松的找到库了。解决方法:获取 库文件所在的文件路径 ,添加到Target的Build Settings界面,如图:若上述方法还未能解决,以下共有3种方法方法一:点击 XCode 工程文件,在.
NSMutableArray 为什么不能用copy修饰 官方文档解释:__NSFrozenArrayM - an immutable NSArray sharing its storage with an NSMutableArray that it was -copy’d from (will do a real copy if the original array is mutated)“从 NSMutableArray 的 copy 函数返回的 NSArrayI,暂时与原数组共用一段内存,若原数组变化则再真正复制一次”。这是熟悉的 copy-on
UIView 被移除添加的监听方法 - 当视图添加子视图时调用- (void)didAddSubview:(UIView *)subview;- 当子视图从本视图移除时调用- (void)willRemoveSubview:(UIView *)subview;- 当视图即将加入父视图时 / 当视图即将从父视图移除时调用- (void)willMoveToSuperview:(nullable UIView *)newSuperview;- 当视图加入父视图时 / 当视图从父视图移除时调用- (void)didMov...
iOS KVO 监听数组变化 首先,数组不能直接使用KVO使用监听。当我们想要使用KVO监听数组,我们需要进行一下几步。1.KVO不能监听UIViewController中的数组。我们需要先创建一个模型,将数组添加值模型中。@interface SelectedsArr : NSObject@property (nonatomic, strong) NSMutableArray *selecteds;///<选中的选项集合@end2.建立观察者以及观察者对象[self.selectedsArr addObser
early EOF fatal: index-pack failed First, turn off compression:git config --global core.compression 0Next, let's do a partial clone to truncate the amount of info coming down:git clone --depth 1 repo_URIWhen that works, go into the new directory and retrieve the rest of the clone:git
ios首行缩进 NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init]; paragraphStyle.firstLineHeadIndent = 15; // 首行缩进 paragraphStyle.alignment = NSTextAlignmentJustified;...
UIScrollView自适应高度 UIScrollView *scrollView = [[UIScrollView alloc]init]; scrollView.showsHorizontalScrollIndicator=NO; scrollView.showsVerticalScrollIndicator = NO; [self addSubview:scrollView]; [scro...
.gitignore忽略文件无效的解决办法 .gitignore中已经标明忽略的文件目录下的文件,git push的时候还会出现在push的目录中,原因是因为在git忽略目录中,新建的文件在git中会有缓存,如果某些文件已经被纳入了版本管理中,就算是在.gitignore中已经声明了忽略路径也是不起作用的,这时候我们就应该先把本地缓存删除,然后再进行git的push,这样就不会出现忽略的文件了。git清除本地缓存命令如下:git rm ...
ios导航栏移除栈中某一个控制器 NSMutableArray *vcArr = [[NSMutableArray alloc]initWithArray:self.navigationController.viewControllers]; for (UIViewController *vc in vcArr) { if ([vc isKindOfClass:[someone class...
RAC几个常用的方法 ///KVO [[self.header rac_valuesForKeyPath:@"" observer:self]subscribeNext:^(id _Nullable x) { } completed:^{ }]; ///通知中心 [[[NSNotificationCenter defaultCenter]r...
UITabBar修改顶部线条颜色 CGRect rect = CGRectMake(0.0f, 0.0f, self.view.bounds.size.width, 0.5); UIGraphicsBeginImageContextWithOptions(rect.size,NO, 0); CGContextRef context =UIGraphicsGetCurrentContext(); CGCon...
iOS拦截crash异常 NSSetUncaughtExceptionHandler(handle);void handle(NSException *exception){ NSLog(@"崩溃的原因是%@",exception.reason); NSLog(@"崩溃的名称是%@",exception.name); NSLog(@"崩溃的堆栈信息是%@",exception.call...
iOS手势返回的取消与开启 - (void)viewDidAppear:(BOOL)animated{ [super viewDidAppear:animated]; // 禁用返回手势 if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) { se...