(Turn) summarizes the various pit of iOS 8 and Xcode 6

Transfer from http://www.tuicool.com/articles/ZJvmM3

 

Project path pit

Path from the simulator before  ~/Library/Application Support/iPhone Simulator moving into  ~/Library/Developer/CoreSimulator/Devices/ this very pit father, before running this simulator which simulator directly select the folder into the project will be able to find with  ios%207%20path.pngguys, under Devices directory does not indicate the version of the emulator, select the picture corresponding probably iPhone 5s 7.1 of  iOS%208.pngthen files in the picture folder corresponding should be  iPhone 4s 7.1 iPhone 4s 8.0 iPhone 5s 7.1 iPhone 5s 8.0 ......., but I do not know which corresponds to which ah, well I'm going crazy 

NSUserDefaults pit

By  NSUserDefaults data locally stored, deleted simulator APP, can not empty the data after clean, I try to remove the iPhone 4s, iPhone 5s ...... with a project inside, still no solution, this should be a BUG, such as Apple Xcode update it (I am currently using 6.0). But the real machine is not the case (a must ah) 

UITableView pit

If the interface with UITableView to encounter the following warning

 

Warning once only: Detected a case where constraints ambiguously suggest a height of zero for a tableview cell's content view. We're considering the collapse unintentional and using standard height instead.

Add the following code to resolve

self.tableView.rowHeight = 44.0f;

autolayout pit

Typical UITabBarController as the root view, and then click on a page when the push button to a list page, the structure as shown below  storyboard.jpgif you want to hide the list page tabbar, so I tend to bottombar in this VC is set to none in order to better constrain the layout,  bottombar.pngbut ...... when debugging you will find a list into the bottom of the page a moment tabbar height of view appears. Or honestly in to use the default Inferred it. 

Keyboard not bombs

keyboard.pngDeselect Connect Hardware Keyboard 

detailTextLabel can not be displayed

First come the following code

- (void)viewDidLoad
{
  [super viewDidLoad];
  dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
   self.array = @[@"测试"];   [self.tableView reloadData];  }); } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{  return 1; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{  return 1; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TradeRecordCell"                forIndexPath:indexPath];  cell.detailTextLabel.text = _array[indexPath.row];  return cell; } 

Code no problem in iOS 7, a second later the detailTextLabel cell will display  测试 the word, but in iOS 8 but not detailTextLabel appears to be empty. Test found that when the text detailTextLabel beginning to empty, iOS 8 will run under this label's size setting (0, 0) and thus can not display correctly, because here  cell.detailTextLabel.text = _array[indexPath.row]; the beginning of data is empty, the solution: 

If you will not go empty set value

    if (_array[indexPath.row]) {
        cell.detailTextLabel.text = _array[indexPath.row];
    }

or

cell.detailTextLabel.text = _array[indexPath.row] ? : @" ";

pch file missing

Xcode 6 project is now created by default without pch file, of course, the old version of the project is to be retained. So how do you add pch file?

* Command + N and then select which Other PCH File

* Build Settings found inside  Prefix Header pch.jpg

* Add pch file, the rule is:  project name /xxxxx.pch

UIAlertView pit

Untitled UIAlertView display long text issues

UIAlertView *alterView = [[UIAlertView alloc] initWithTitle:nil message:@"远端Git仓库和标准的Git仓库有如下差别:一个标准的Git仓库包括了源代码和历史信息记录。我们可以直接在这个基础上修改代码,因为它已经包含了一个工作副本。" delegate:self cancelButtonTitle:@"知道了" otherButtonTitles:nil, nil]; [alterView show]; 

The above code in iOS 8 look at shows like this, complete the top to the top of the content, text, bewildered bolded  alert.pngDid I'll tell you just set the title  @"" on the line yet 

 UIAlertView *alterView = [[UIAlertView alloc] initWithTitle:@"" message:@"远端Git仓库和标准的Git仓库有如下差别:一个标准的Git仓库包括了源代码和历史信息记录。我们可以直接在这个基础上修改代码,因为它已经包含了一个工作副本。" delegate:self cancelButtonTitle:@"知道了" otherButtonTitles:nil, nil];
[alterView show];

Reproduced in: https: //www.cnblogs.com/pretty-guy/articles/4312907.html

Guess you like

Origin blog.csdn.net/weixin_33811539/article/details/93438741