debug YES becoz u only want to build in your testing device (or compile too long time and waste the other arch build)
release NO u should make sure all ios devices can run
debug YES becoz u only want to build in your testing device (or compile too long time and waste the other arch build)
release NO u should make sure all ios devices can run
self.artworkView.contentMode = UIViewContentModeScaleAspectFill;
[self.artworkView makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.superview.centerX);
make.centerY.equalTo(self.superview.centerY);
make.width.equalTo(self.superview.width);
}];
method 1. typecast
APPDetailViewController myController = (APPDetailViewController)segue.destinationViewController;
myController.myString = string;
method 2. selector
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.destinationViewController respondsToSelector:@selector(setMyData:)]) {
[segue.destinationViewController performSelector:@selector(setMyData:)
withObject:myData];
}
}
in destination View Controller
@property (nonatomic, strong) MyData *myData;
2014-08-06 12:17:02.511 Jtab[6255:60b] *** Assertion failure in -[JTChordCollectionView layoutSublayersOfLayer:], /SourceCache/UIKit/UIKit-2935.138/UIView.m:8794 2014-08-06 12:17:02.512 Jtab[6255:60b] *** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘Auto Layout still required after executing -layoutSubviews. JTChordCollectionView’s implementation of -layoutSubviews needs to call super.’
[super layoutSubviews];
[chordLabelView makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(labelPlaceHolder.centerX);
make.centerY.equalTo(labelPlaceHolder.centerY);
}];
solve by add [super layoutSubviews]; before add constraints ….
-(void)fitFontSize:(UILabel*)label {
CGFloat actualFontSize;
[label.text sizeWithFont:label.font
minFontSize:label.minimumFontSize
actualFontSize:&actualFontSize
forWidth:label.bounds.size.width
lineBreakMode:label.lineBreakMode];
label.font = [label.font fontWithSize:actualFontSize];
label.adjustsFontSizeToFitWidth = NO;
}
usage: self.keyLabel = [self makeLabel:[UIFont fontWithName:@”AkzidenzGroteskBE-BoldCn” size:45.0f]];
self.keyLabel.frame = CGRectMake(0, 0, self.cellWidth / 4.0, self.cellHeight);
self.keyLabel.text = @"C";
[self fitFontSize:self.keyLabel];
[self.keyLabel sizeToFit];
[self.keyLabel makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.centerX);
make.centerY.equalTo(self.centerY);
}];
// this function will auto load by storyboard
-(void)setKeyLabel:(UILabel *)keyLabel {
if (_keyLabel != keyLabel) {
_keyLabel = keyLabel;
_keyLabel.font = [UIFont fontWithName:@"SOME-FONT-NAME" size:20.0f];
_keyLabel.textColor = SOME-UI_COLOR;
}
}
constraints is funny
if u use Masonry or updateConstraints to a UIView, may no reaction till u drag one constraints to it…
Becoz
But sometimes it will say broken, becoz the constraints jammed… so… one solution:
it will ignore all the storyboard constraints, so u can use the coding one now.