0

I have created an iOS APP for iPad and my application is using XIB. On XIB I have put a UIImageView and UIButtonview and set the image on both of them. The image is showing on XIB but when I am testing it on simulator then both of these views is not showing. I have checked hidden and alpha of both views.

I have debugged my source code and found that it may be because of Alpha. You can see the attached screenshot. I have not written any source code in my .m file, simply load the viewcontroller from xib But still it's Alfa is changing I don't how alfa is changing enter image description here

In my project ,I am also using following source code

/***** MyView.h************/

@interface UIImageView (MyView)

- (void) setAlpha:(float)alpha ;

@end

/***** MyView.M************/

@implementation UIImageView (MyView)

- (void) setAlpha:(float)alpha 

 //here alpha value is always zero but under xib it's value is 1
 //I Don't know why here I am getting zero

{

    [super setAlpha:alpha];

}

@end

I don't know why it is happening, can anyone please help me.

hitesh landge
  • 362
  • 4
  • 14
  • Have you tried deleting the app from the simulator? – Nick Jul 12 '18 at 09:37
  • have you tried setting the proper constraints to imageView? – Bhavin Kansagara Jul 12 '18 at 09:38
  • @hitesh put some code or screenshot so we can get the idea what is happening. – Chirag Shah Jul 12 '18 at 09:47
  • I have debugged my source code and found that it may be because of Alpha.You can see attached screen shot.I have not written any source code in my .m file,simlpy load the viewcontroller from xib But still it's Alfa is changing I don't how alfa is changing. – hitesh landge Jul 12 '18 at 10:13
  • Why you are adding category to UIImageView? You already have alpha method, I would suggest remove this category and if you want to change alpha just use setAlpha method. – nikBhosale Jul 12 '18 at 15:10

1 Answers1

0

I got the solution my self I need to use "CGFloat" at the place of "float"

/***** MyView.h************/

@interface UIImageView (MyView)

- (void) setAlpha:(CGFloat)alpha ;

@end

/***** MyView.M************/

@implementation UIImageView (MyView)

- (void) setAlpha:(CGFloat)alpha 
{

    [super setAlpha:alpha];

}

@end
hitesh landge
  • 362
  • 4
  • 14