ConfirmView.m 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. //
  2. // ConfirmView.m
  3. // HuaweiMeeting
  4. //
  5. // Created by imac on 12-10-15.
  6. // Copyright (c) 2012年 Twin-Fish. All rights reserved.
  7. //
  8. #import "ConfirmView.h"
  9. #import "UIFactory.h"
  10. #import "QuartzCore/QuartzCore.h"
  11. @implementation ConfirmView
  12. @synthesize temp_delegate;
  13. - (id)initWithFrame:(CGRect)frame
  14. {
  15. self = [super initWithFrame:frame];
  16. if (self) {
  17. // Initialization code
  18. }
  19. return self;
  20. }
  21. /*
  22. // Only override drawRect: if you perform custom drawing.
  23. // An empty implementation adversely affects performance during animation.
  24. - (void)drawRect:(CGRect)rect
  25. {
  26. // Drawing code
  27. }
  28. */
  29. - (void)show
  30. {
  31. temp_delegate = self.delegate;
  32. self.delegate = self;
  33. [super show];
  34. }
  35. //- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated
  36. //{
  37. // [super dismissWithClickedButtonIndex:buttonIndex animated:NO];
  38. // [[self class] setAnimationsEnabled:YES];
  39. //}
  40. - (void)willPresentAlertView:(UIAlertView *)alertView
  41. {
  42. for (UIView *view in self.subviews) {
  43. if ([view isKindOfClass:[UIImageView class]]) {
  44. [view.layer setCornerRadius:8];
  45. [view.layer setMasksToBounds:YES];
  46. ((UIImageView *)view).image = nil;
  47. [view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"com_repeat_paper"]]];
  48. } else if ([view isKindOfClass:[UIButton class]]) {
  49. CGFloat buttonHeight = [[UIDevice currentDevice].model hasPrefix:@"iPad"] ? 33.0f : 33.0f;
  50. CGRect buttonFrame = view.frame;
  51. buttonFrame.origin.y += CGRectGetHeight(buttonFrame) - buttonHeight;
  52. buttonFrame.size.height = buttonHeight;
  53. view.frame = buttonFrame;
  54. UIImage *normalImage = [UIFactory resizableImageWithSize:CGSizeMake(4.0f, 0.0f) image:[UIImage imageNamed:@"com_button1_normal"]];
  55. UIImage *clickImage = [UIFactory resizableImageWithSize:CGSizeMake(4.0f, 0.0f) image:[UIImage imageNamed:@"com_button1_click"]];
  56. [((UIButton *)view) setBackgroundImage:normalImage forState:UIControlStateNormal];
  57. [((UIButton *)view) setBackgroundImage:clickImage forState:UIControlStateHighlighted];
  58. [((UIButton *)view).titleLabel setFont:[UIFont systemFontOfSize:16]];
  59. [((UIButton *)view) setTitleShadowColor:[UIColor clearColor] forState:UIControlStateNormal];
  60. [((UIButton *)view) setTitleShadowColor:[UIColor clearColor] forState:UIControlStateHighlighted];
  61. [((UIButton *)view) setTitleColor:[UIColor colorWithRed:82.0/255 green:30.0/255 blue:4.0/255 alpha:1.0]
  62. forState:UIControlStateNormal];
  63. [((UIButton *)view) setTitleColor:[UIColor colorWithRed:82.0/255 green:30.0/255 blue:4.0/255 alpha:1.0]
  64. forState:UIControlStateHighlighted];
  65. } else if ([view isKindOfClass:[UILabel class]]) {
  66. ((UILabel *)view).textColor = [UIColor blackColor];
  67. ((UILabel *)view).shadowColor = [UIColor clearColor];
  68. }
  69. }
  70. self.delegate = temp_delegate;
  71. }
  72. @end