2013-11-15 23 views
-1

如何確定UIVIew的終點?我知道你可以做self.descriptionTextView.bounds.origin.y,但這並沒有考慮到視圖的大小。如何確定UITextVIew的終點?

我可以這樣做:self.descriptionTextView.bounds.origin.y+(unsigned long)listingShortDescription.length+10

感謝您的幫助

+0

你所說的 「終點」 是什麼意思?文本視圖底邊的座標? – DrummerB

+0

bounds.origin.y將始終爲零。 – Schoob

+0

@Schoob不在UITextView中(這是一個UIScrollView)。 – DrummerB

回答

1

self.descriptionTextView.bounds.origin.y會給你0 爲界具有CGPointZero的原點。 改爲使用框架。 self.descriptionTextView.frame.origin.y + self.descriptionTextView.frame.size.height

更妙的是:

CGRectGetMaxY(self.descriptionTextView.frame) 
1
CGRectMaxYEdge(self.descriptionTextView.frame); 

這會給你的座標,如果文本視圖在其父視圖的座標空間的底部邊緣。