Skip to content

Commit 83dd3f7

Browse files
committed
frame re-adjustments for description label and its sizing
1 parent 20b0f7b commit 83dd3f7

File tree

4 files changed

+18
-20
lines changed

4 files changed

+18
-20
lines changed

Example/FCAlertView/ExampleViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger
459459
headerView.backgroundColor = [UIColor colorWithWhite:239.0f/255.0f alpha:1.0];
460460

461461
UILabel *headerLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 20, headerView.frame.size.width - 60, 20)];
462-
headerLabel.text = @"NEW FEATURES • V1.2.0";
462+
headerLabel.text = @"NEW FEATURES • V1.2.0+";
463463

464464
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:@"NEW FEATURES • V1.2.0"];
465465
[attributedString addAttribute:NSKernAttributeName

Example/Pods/FCAlertView/FCAlertView/Classes/FCAlertView.m

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

FCAlertView.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'FCAlertView'
11-
s.version = '1.2.7'
11+
s.version = '1.2.8'
1212
s.summary = 'FCAlertView is a Flat Customizable AlertView'
1313

1414
# This description is used to generate tags and improve search results.

FCAlertView/Classes/FCAlertView.m

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,7 @@ - (id)init
7272

7373
defaultSpacing = [self configureAVWidth];
7474
defaultHeight = [self configureAVHeight];
75-
76-
[self checkCustomizationValid];
77-
75+
7876
}
7977

8078
return self;
@@ -354,12 +352,14 @@ - (void)drawRect:(CGRect)rect {
354352
else
355353
descriptionLabel.font = [UIFont systemFontOfSize:16.0f weight:UIFontWeightRegular];
356354

357-
descriptionLabel.numberOfLines = 6;
358355
descriptionLabel.textColor = self.subTitleColor;
359356
descriptionLabel.text = self.subTitle;
360357
descriptionLabel.textAlignment = NSTextAlignmentCenter;
361358
descriptionLabel.adjustsFontSizeToFitWidth = NO;
362359

360+
descriptionLabel.numberOfLines = 0;
361+
descriptionLabel.lineBreakMode = NSLineBreakByTruncatingTail;
362+
363363
// Re-adjusting Frames based on height of text - Requirement is to not have over 6 lines of text
364364

365365
CGSize constraint = CGSizeMake(descriptionLabel.frame.size.width, CGFLOAT_MAX);
@@ -370,18 +370,16 @@ - (void)drawRect:(CGRect)rect {
370370
options:NSStringDrawingUsesLineFragmentOrigin
371371
attributes:@{NSFontAttributeName:descriptionLabel.font}
372372
context:context].size;
373-
374-
sizeOfText = CGSizeMake(ceil(boundingBox.width), MIN(ceil(boundingBox.height), 108));
375-
376-
CGFloat heightDiff = descriptionLabel.frame.size.height - sizeOfText.height;
373+
374+
CGFloat heightDiff = descriptionLabel.frame.size.height - boundingBox.height;
377375

378376
descriptionLabel.frame = CGRectMake(descriptionLabel.frame.origin.x,
379377
descriptionLabel.frame.origin.y + 7.5,
380378
descriptionLabel.frame.size.width,
381-
sizeOfText.height);
379+
boundingBox.height);
382380

383381
alertViewFrame = CGRectMake(alertViewFrame.origin.x,
384-
alertViewFrame.origin.y,
382+
alertViewFrame.origin.y + ((heightDiff + 15)/2),
385383
alertViewFrame.size.width,
386384
alertViewFrame.size.height - heightDiff + 15);
387385

@@ -1650,4 +1648,4 @@ - (void) setActiveRating:(NSInteger)rating {
16501648

16511649
}
16521650

1653-
@end
1651+
@end

0 commit comments

Comments
 (0)