JXTipBlackView.m 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // TipBlackView.m
  3. // shiku_im
  4. //
  5. // Created by MacZ on 16/4/18.
  6. // Copyright (c) 2016年 Reese. All rights reserved.
  7. //
  8. #import "JXTipBlackView.h"
  9. @implementation JXTipBlackView
  10. - (id)initWithTitle:(NSString *)title{
  11. self = [super initWithFrame:CGRectMake(0, 0, 200, 50)];
  12. if (self) {
  13. self.center = CGPointMake(JX_SCREEN_WIDTH/2, JX_SCREEN_HEIGHT/2);
  14. _titleLabel = [[UILabel alloc] initWithFrame:self.bounds];
  15. _titleLabel.text = title;
  16. _titleLabel.backgroundColor = [UIColor blackColor];
  17. _titleLabel.layer.masksToBounds = YES;
  18. _titleLabel.layer.cornerRadius = _titleLabel.frame.size.height/2;
  19. _titleLabel.textColor = [UIColor whiteColor];
  20. _titleLabel.font = SYSFONT(14);
  21. _titleLabel.textAlignment = NSTextAlignmentCenter;
  22. _titleLabel.alpha = 0.6;
  23. [self addSubview:_titleLabel];
  24. // [_titleLabel release];
  25. }
  26. return self;
  27. }
  28. - (void)show{
  29. [UIView animateWithDuration:1.0 delay:0.6 options:UIViewAnimationOptionTransitionNone animations:^{
  30. _titleLabel.alpha = 0;
  31. } completion:^(BOOL finished) {
  32. [self removeFromSuperview];
  33. }];
  34. }
  35. /*
  36. // Only override drawRect: if you perform custom drawing.
  37. // An empty implementation adversely affects performance during animation.
  38. - (void)drawRect:(CGRect)rect {
  39. // Drawing code
  40. }
  41. */
  42. @end