1.去除选中样式
cell.selectionStyle =UITableViewCellSelectionStyleNone;
2.隐藏分割线
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
3.隐藏滚动条
self.tableView.showsVerticalScrollIndicator = NO;
4.判断当前屏幕是否包含某行cell
[self.tableView.indexPathsForVisibleRows containsObject:indexPath]
5.某一行cell即将开始展示
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
6.某一行cell即将移出屏幕
- (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
7.让tableView编辑时可以被点击
tableView.allowsSelectionDuringEditing =YES;
8.控制器的automaticallyAdjustsScrollViewInsets属性
self.automaticallyAdjustsScrollViewInsets =false
9.tableView的头部总是有灰块?
可能是设置2个代理的位置不对
delegate好dataSource尽量写在前面->
override func awakeFromNib() {
self.table?.delegate =self
self.table?.dataSource =self
}
不能写在网络请求之后!
scrollView最侧边不能滚动
scrollView.bounces = NO;3.tableView最后一行分割线不显示
- (void)layoutSubviews {
[superlayoutSubviews];
for (UIView *subviewinself.contentView.superview.subviews) {
if ([NSStringFromClass(subview.class)hasSuffix:@"SeparatorView"]) {
subview.hidden = NO;
}
}
}
4.Cell没有填充上的原因:
button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; 这行代码,把按钮的内容(控件)
的对齐方式修改为水平左对齐,但是这们会紧紧靠着左边,不好看,
所以我们还可以修改属性:
button.titleEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);
// 添加上这一句,可以去掉导航条下边的shadowImage,就可以正常显示了self.navigationController.navigationBar.shadowImage = [[UIImage alloc] init];
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManagermanager];
// 设置请求格式为JSON
manager.requestSerializer = [AFJSONRequestSerializerserializer];
// 解析格式 :不设置具体的解析格式,只需要拿到数据
manager.responseSerializer = [AFHTTPResponseSerializerserializer];
[manager.requestSerializerwillChangeValueForKey:@"timeoutInterval"];
manager.requestSerializer.timeoutInterval =10.f;
[manager.requestSerializerdidChangeValueForKey:@"timeoutInterval"];
在xcode右侧的inspector视图里把Autolayout属性的勾去掉就可以了
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
{
BOOL inside = [super pointInside:point withEvent:event];
if (!inside && self.selected)
{
inside = [self.calloutView pointInside:[self convertPoint:point toView:self.calloutView] withEvent:event];
}
return inside;
}
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
UIButton * btn = (UIButton *)[self.view viewWithTag:101];
if (CGRectContainsPoint(btn.frame, point)) {
return btn;
}
for (UIButton * btn in self.view.frameArr) {
if (CGRectContainsPoint(btn.frame,point)) {
return btn;
}
}
return self;
}
@property (nonatomic,copy)NSString *description;
@end
@implementation BXTool
@synthesize description = _description;
由于要根据返回值进行判断,做出必要反应,因此必须知道返回值所代表的具体字符,在得到(null)后利用isEqual:和@“”,NULL,@“(null)”,nil,Nil比较后均得不到正确结果,弄得不知所措了,但是还是感觉像nil,不得已,创建一个字符串,赋值为nil,打印输出,果然是(null),想不通的是为什么不等。最后试了一下“==”,成功了。费尽周折之后才明白原来要这样用:
if(m_result==nil)
{
NSLog(@"KDA!");
}
还有就是
if([m_result isEqual:[NSNUll null]])
{
NSLog(@"KDA!");
}
18.引入第三方库出现file not found
比如iOS 引入支付宝 缺少 #include
解决方法如下:在你的Xcode里的header search paths 里添加支付宝SDK(openssl的路径);格式如下 $(PROJECT_DIR)/文件夹名 (这里说一下,直接点击openssl,然后showinfinder,然后command + i 查看路径,把得到路径的工程名字以后的部分加在文件夹名这OK了)
19.使用sdwebimage给button设置图片不显示,只显示系统蓝色
button的Type需要设置为Custome
let isiPad = UIDevice.currentDevice().userInterfaceIdiom == .Pad
let isiPhone = UIDevice.currentDevice().userInterfaceIdiom == .Phone
if (isiPad) {
var popPresenter = alertVC.popoverPresentationController
// popPresenter!.barButtonItem = self.navigationItem.leftBarButtonItem;
popPresenter?.sourceView = btn
// popPresenter!.arrowDirection
popPresenter?.sourceRect = btn.bounds
popPresenter?.permittedArrowDirections = .Up
////
}
tf.inputAccessoryView = UIView()