iOS 开发时,四月问题记录

1.问:如下这堆类似乱码的是什么?


%7B%22cc%22%3A%22619%22%2C%22ct%22%3A10%2C%22p%22%3A14588%2C%22dt%22%3A0%2C%22v%22%3A%228.0.4%22%7D&d=%7B%22index%22%3A0%2C%22sort%22%3A1%2C%22sortVariable%22%3A1%2C%22districtCode%22%3A0%2C%22hotelLabels%22%3A%5B%5D%2C%22poiCodes%22%3A%5B%5D%2C%22radius%22%3A0%2C%22cityCode%22%3A619%2C%22lowPrice%22%3A0%2C%22lng%22%3A%22113.874693%22%2C%22stars%22%3A%5B%5D%2C%22limit%22%3A10%2C%22page%22%3A1%2C%22brands%22%3A%5B%5D%2C%22checkOutDate%22%3A%222016-04-19%22%2C%22isMyLocation%22%3Atrue%2C%22checkInDate%22%3A%222016-04-18%22%2C%22lat%22%3A%2222.565935%22%2C%22facilities%22%3A%5B%5D%2C%22highPrice%22%3A0%2C%22key%22%3A%22%22%7D

答:搜索URLDecode解码。

2.在使用代理方法tableView viewForHeaderInSection 时会出现一个问题

最初代码:


- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section

{

    static NSString *identifier = @"headViewIdentifer";

    UITableViewCell *headView = [tableView dequeueReusableCellWithIdentifier:identifier];

    return headView;

}

如果你加入TextFiled此类输入型控件的时候,就会出现no index path for table cell being reused 然后 head view就消失不见

同时,收回键盘Dismiss on drag也出现的问题是


[UIWindow endDisablingInterfaceAutorotationAnimated:] called on> without matching -beginDisablingInterfaceAutorotation. Ignoring.

答:解决办法加入view,此外autoresizingMask自己试试哪个合适你自己的


- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section

{

    static NSString *identifier = @"headViewIdentifer";

    UITableViewCell *headView = [tableView dequeueReusableCellWithIdentifier:identifier];

    UIView *view = [[UIView alloc]initWithFrame:[headView frame]];

    headView.autoresizingMask =  UIViewAutoresizingFlexibleWidth;

    [view addSubview:headView];

    return view;

}

收回键盘使用endEditing


- (void)scrollViewDidScroll:(UIScrollView *)scrollView

{

    [scrollView endEditing:YES];

}

3.在Tableview的head view和cell之间有一个横线,白色的


屏幕快照 2016-04-21 下午5.20.03.png

答:解决办法就是填充cell和head view的background颜色,两个都要填


屏幕快照 2016-04-21 下午5.21.31.png

填充后:
屏幕快照 2016-04-21 下午5.22.32.png

4.如何tableview 的Cell滚动顶部键盘挡不住
答:

NSIndexPath *scrollIndexPath = [NSIndexPath indexPathForRow:indexPath.row inSection:indexPath.section];
    
[self.tableView scrollToRowAtIndexPath:scrollIndexPath
                                 atScrollPosition:UITableViewScrollPositionTop animated:YES];

5.如何跳到AppStore的评论页?
答:

NSString *iTunesLink = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=%@&onlyLatestVersion=true&pageNumber=0&sortOrdering=1&type=Purple+Software", AppID];  
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:iTunesLink]];  

6.iOS开发,icon各种尺寸问题
答:请看苹果官方的
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html
7.iOS如何隐藏导航栏
答:

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
    self.navigationController.navigationBarHidden = NO;
}

你可能感兴趣的:(iOS 开发时,四月问题记录)