2013-02-07 110 views
2

分配到「NSLineBreakMode」更新我的Xcode 4.5〜4.6 ....從不兼容的類型

lblMyLable.lineBreakMode = UILineBreakModeWordWrap; 
textFieldRounded1.textAlignment = UITextAlignmentLeft; 

停止工作,其顯示不兼容的錯誤後......他們只是在Xcode的更新前的工作2天之前好。

P.S: - lblMyLable是一個UILabel & textFieldRounded1是爲UITextField

我使用6.1 IOS SDK

+2

棄用。人們總是認爲平臺供應商開玩笑說他們的棄用警告...... :) –

回答

2

在iOS 6中,你需要使用NSLineBreakByWordWrapping。 相反的:

lblMyLable.lineBreakMode = UILineBreakModeWordWrap; 
textFieldRounded1.textAlignment = UITextAlignmentLeft; 

用途:

lblMyLable.lineBreakMode = NSLineBreakByWordWrapping; 
textFieldRounded1.textAlignment = NSTextAlignmentLeft; 

詳細

lineBreakMode

用於包裝和TRUNC的技術在標籤的文字上。 @property(nonatomic) NSLineBreakMode lineBreakMode;

討論

如果使用在IOS 6或更高樣式的文本,該屬性分配一個新的值 使線中斷模式下被施加到 整體在所述串的屬性文字屬性。如果您想要 僅將分行符模式應用於文本的一部分,請使用所需的樣式信息創建一個新的 歸因字符串,並將其與 與標籤相關聯。如果您未使用樣式文本,則此屬性 將應用於文本屬性中的整個文本字符串。

這家酒店無論是在正常的圖紙和在字體大小必須被縮小到適合其 邊框標籤的文本的情況下 生效。此屬性默認設置爲NSLineBreakByTruncatingTail 。

重要:如果這個屬性被設置爲使文本換 到另一條線的值,它是一個程序員的錯誤設置要麼 adjustsFontSizeToFitWidth或adjustsLetterSpacingToFitWidth財產 爲YES。

特別注意事項

在iOS 5中以及更早版本,此屬性的類型是UILineBreakMode。 可用性

Available in iOS 2.0 and later. 

NSLineBreakMode

這些常量指定何時線路太長,其 容器會發生什麼。

enum { 
    NSLineBreakByWordWrapping = 0, 
    NSLineBreakByCharWrapping, 
    NSLineBreakByClipping,  
    NSLineBreakByTruncatingHead, 
    NSLineBreakByTruncatingTail,  
    NSLineBreakByTruncatingMiddle 
}; 
typedef NSUInteger NSLineBreakMo 

常量

NSLineBreakByWordWrapping

Wrapping occurs at word boundaries, unless the word itself doesn’t fit on a single line. 

Available in iOS 6.0 and later. 

Declared in NSParagraphStyle.h. 

NSLineBreakByCharWrapping

Wrapping occurs before the first character that doesn’t fit. 

Available in iOS 6.0 and later. 

Declared in NSParagraphStyle.h. 

NSLineBreakByClipping

Lines are simply not drawn past the edge of the text container. 

Available in iOS 6.0 and later. 

Declared in NSParagraphStyle.h. 

NSLineBreakByTruncatingHead

The line is displayed so that the end fits in the container and the missing text at the beginning of the line is indicated by an 

省略號字形。儘管此模式適用於多行文本,但更經常用於單行文本的文本是 。

Available in iOS 6.0 and later. 

Declared in NSParagraphStyle.h. 

NSLineBreakByTruncatingTail

The line is displayed so that the beginning fits in the container and the missing text at the end of the line is indicated by an 

省略號字形。儘管此模式適用於多行文本,但更經常用於單行文本的文本是 。

Available in iOS 6.0 and later. 

Declared in NSParagraphStyle.h. 

NSLineBreakByTruncatingMiddle

The line is displayed so that the beginning and end fit in the container and the missing text in the middle is indicated by an 

省略號字形。儘管此模式適用於多行文本,但更經常用於單行文本的文本是 。

Available in iOS 6.0 and later. 

Declared in NSParagraphStyle.h. 

請以瞭解詳情UILabel Class。 另請參閱UITextField Class瞭解NSTextAlignment值和詳細信息。

+0

沒問題...對於UItextField ...? – Saty

+0

此外,'UITextAlignmentLeft'已被替換爲'NSTextAlignmentLeft'。 –

+0

textFieldRounded.textAlignment =?我應該在哪裏放? – Saty