UIScrollview上的UIPangesturerecognizer冲突
在tableview里的cell的imageview上加个UIPangesturerecognizer会发现优先滚动imageview,tableView不响应滚动了,原因是tableview的实现也是用了UIPangesturerecognizer。解决方案如下:
CGRect函数
CGRectOffset使用从源CGRect偏移的原点来创建矩形
float offset = 25.0;CGRect r1 = CGRectMake(100, 100, 100, 100);CGRect r2 = CGRectOffset(r1, offset, offset);CGRectIntersectsRect允许我们确定两个矩形是否相交
float offset = 25.0;CGRect r1 = CGRectMake(100, 100, 100, 100);CGRect r2 = CGRectMake(150, 150, 100, 100);if (CGRectIntersectsRect(r1, r2)){NSLog(@"intersecting");}NSStringFromCGRect可以用来把CGRect显示到控制台
CGRect r1 = CGRectMake(100, 100, 100, 100);NSLog(@"rect:@%",NSStringFromCGRect(r1));// 同样,CGRectFromString允许我们根据一个字符串创建一个CGRect:NSString *r = @"{0,0},{100,100}";CGRect r1 = CGRectFromString(r);
为视图某个角添加圆角
|
若配置某个角为圆角的话,只需要指定对应的UIRectCorner即可:
设置UITableView的分割线顶头
使用setSeparatorInset:UIEdgeInsetsZero来解决:
直接对tableView进行设置:
if ([_tableView respondsToSelector:@selector(setSeparatorInset:)]) {[_tableView setSeparatorInset:UIEdgeInsetsZero];}if ([_tableView respondsToSelector:@selector(setLayoutMargins:)]) {[_tableView setLayoutMargins:UIEdgeInsetsZero];}实现UITableViewDelegate的代理方法:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {[cell setSeparatorInset:UIEdgeInsetsZero];}if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {[cell setLayoutMargins:UIEdgeInsetsZero];}}
去掉分割线 _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
Frame布局时使用CGRectInset设置左右、上下边距
|
PCH文件配置
如图:在Build Settings内搜索prefix header
然后修改为$(SRCROOT)/Mydemo/MydemoPrefixHeader.pch
其中Mydemo
对应project name, MydemoPrefixHeader.pch
对应PCH file
SDK出现libc++abi.dylib: terminating
SDK出现libc++abi.dylib: terminating with uncaught exception of type NSException 的问题解决方法:
工程文件中选择Build Setting,在”Other Linker Flags”中加入”-Objc -all_load”
查找在数组中NSNumber的最大值和最小值
|