Skip to content

Instantly share code, notes, and snippets.

@xandrucea
Last active December 18, 2015 15:19
Show Gist options
  • Select an option

  • Save xandrucea/5803881 to your computer and use it in GitHub Desktop.

Select an option

Save xandrucea/5803881 to your computer and use it in GitHub Desktop.
UIView Snippets
int count = 0;
for(UIView *v in [actualView subviews]){
if([v isMemberOfClass:[UIView class]]){
NSLog(@"Aktual View %d: %@", count, v);
count++;
}
}
- (void)printMyFrame:(CGRect)aFrame{
static int view = 0;
NSLog(@"FRAME %d: %f, %f, %f, %f",
view, aFrame.origin.x, aFrame.origin.y, aFrame.size.width, aFrame.size.height);
view++;
}
-(void)myLabel:(UILabel *)aLabel withFontSize:(float)aSize{
font = [UIFont fontWithName:GROBOLDpro size:aSize];
aLabel.font = font;
if(screenSize.height > 480.0f){
[self setShadowForLabel:aLabel];
}
}
-(void)setShadowForButton:(UIButton *)aButton{
aButton.imageView.layer.cornerRadius = 3.0f;
aButton.layer.shadowRadius = 1.0f;
aButton.layer.shadowColor = [UIColor blackColor].CGColor;
aButton.layer.shadowOffset = CGSizeMake(1.5f, 1.5f);
aButton.layer.shadowOpacity = 0.9f;
aButton.layer.masksToBounds = NO;
}
- (void)transformScale{
[_viewChat setTransform:CGAffineTransformMakeScale(viewX, viewY)];
// view anchorPoint is initial in the middle of a view
_viewChat.layer.anchorPoint = CGPointMake(0.5f, 0.0f);
[UIView animateWithDuration:fadeOut animations:^{
_viewChat.frame = CGRectMake(frameX, frameY, frameWidth, 0.0f);
_viewChat.transform = CGAffineTransformScale(CGAffineTransformMakeTranslation(1.0f, 0.0f), viewX, 0.0);
} completion:nil];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment