2012-06-12 33 views
0

我對Xcode(4.3.2)和不推薦使用的警告有奇怪的行爲,我想理解爲什麼。 似乎不推薦使用的警告僅在某些方法上觸發。 例如(這兩種方法已被棄用):Xcode和不建議使用的警告並不總是有效

[[UITableViewCell alloc] initWithFrame:CGRectMake(0, 0, 0, 0) reuseIdentifier:@"Cell"]; 

編譯器警告(正確地),該方法已被棄用。 但是:

[self presentModalViewController:viewController animated:YES]; 

不會觸發警告。爲什麼? :-)

回答

1

入住的開發文檔,你會得到這樣的 -

1-它已被棄用currently-

// Frame is ignored. The size will be specified by the table view width and row height.

- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA,__MAC_NA,__IPHONE_2_0,__IPHONE_3_0); 

2 - 它很快就會過時。

// Display another view controller as a modal child. Uses a vertical sheet transition if animated.This method has been replaced by presentViewController:animated:completion: // It will be DEPRECATED, plan accordingly.

- (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated; 

希望它可以清除你爲什麼在第一次收到警告,而不是在第二位。

+0

好的,謝謝,我只是在在線文檔中檢查(它只會告訴「棄用」),但不在.h中:-) – LombaX

相關問題