From f764ef32a538062c773400ddd99de67ebfdcd47c Mon Sep 17 00:00:00 2001 From: Tito Ciuro Date: Thu, 7 Feb 2013 09:04:19 -0800 Subject: [PATCH] Fixed #40: Height for large error example is broken --- NoticeView/WBNoticeView/WBErrorNoticeView.m | 25 ++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/NoticeView/WBNoticeView/WBErrorNoticeView.m b/NoticeView/WBNoticeView/WBErrorNoticeView.m index 3fff5d3..b8d272c 100644 --- a/NoticeView/WBNoticeView/WBErrorNoticeView.m +++ b/NoticeView/WBNoticeView/WBErrorNoticeView.m @@ -59,16 +59,21 @@ r.origin.y = self.titleLabel.frame.origin.y + self.titleLabel.frame.size.height; float noticeViewHeight = 0.0; - // Now we can determine the height of one line of text - r.size.height = self.messageLabel.frame.size.height * numberOfLines; - r.size.width = viewWidth - 70.0; - self.messageLabel.frame = r; - - // Calculate the notice view height - noticeViewHeight = 10.0; - if (numberOfLines > 1) { - noticeViewHeight += ((numberOfLines - 1) * messageLabelHeight); - } + double currOsVersion = [[[UIDevice currentDevice]systemVersion]doubleValue]; + if (currOsVersion >= 6.0f) { + noticeViewHeight = messageLabelHeight; + } else { + // Now we can determine the height of one line of text + r.size.height = self.messageLabel.frame.size.height * numberOfLines; + r.size.width = viewWidth - 70.0; + self.messageLabel.frame = r; + + // Calculate the notice view height + noticeViewHeight = 10.0; + if (numberOfLines > 1) { + noticeViewHeight += ((numberOfLines - 1) * messageLabelHeight); + } + } // Add some bottom margin for the notice view noticeViewHeight += 30.0;