Iphone UIButton not working in nested UIViews -


It's very easy, I'm sure! I forgot something and IM ended with trying to fix it Hope someone can help you.

The character works in the button View.m but the button is given below in Nature Mall. I am not using IB, everything is practically done, will a button work and not others?

  ////////////////////////////////////// ////////////////////////////////////// CharacterController.m////// //////////////////////////////////////////////// /////////////////////#import "Character Controller." #import "CharacterViv H" @ Implementation Character Controller - (ID) Init {NSLog (@ "Character Controller Init"); Self = [super init]; If (self! = Zero) {} back self; } - (zero) load view {[super loadview]; CharacterView = [[Characterist Aloch] init]; Self.view = characterView; } - (zero) did risiv memorialisation [[super davidimmemi warning]; } - (zero) Delok [[Super Delooc]]; }  @End  /////////////////////////////////////////////// ////////////////////////////// CharacterView.m///////////// // ////////////////////////////////////////////// // //////////////// #import "CharacterView.h" #import "CharacterMale.h" @ Permission CharacterView - (id) initWithFrame: (CGRect) frame {if (self = [super InitWithFrame: frame]) {characterMale = [[character mole alloc] init]; [Self-ed SOVview: character Male]; UIButton * button = [UIButtonTypeCustom] with UIButton Button; Button.frame = CGRectMake (0, 200, 200, 100); [Set button image: [UIImage imageNamed: @ "btnCharSelect.png"] forState: UIControlStateNormal]; [Button addTarget: Self-action: @Selector (Applied Image) Control events: UIControl EventTouchUpInside]; [Self adsview: button]; } Healthy return; } - (Zero) Direct: (CGRact) Rect {} - (zero) Applicable Issues: (ID) Sender {NSLog (@ "CharacterWW button works"); } - (zero) Delok [[Super Delooc]]; }  @End  /////////////////////////////////////////////// ////////////////////////////// CharacterMale.m ///////////// // ////////////////////////////////////////////// // //////////////// # Imports "CharacterMail H # # IMPORT" Character Controller. " @ Implementation CharacterMail - (ID) Init {Self- [Super Init]; If (self! = Zero) {UIImage * image = [UIImage imageNamed: @ "charMale.png"]; ImageView = [[UIImageView alloc] initWithImage: Image]; [Image release]; [Self adviewview: image view]; UIButton * button = [UIButtonTypeCustom] with UIButton Button; Button.frame = CGRectMake (0, 0, 200, 100); [Set button image: [UIImage imageNamed: @ "btnCharSelect.png"] forState: UIControlStateNormal]; [Button addTarget: Self-action: @Selector (Applied Image) Control events: UIControl EventTouchUpInside]; [Self adsview: button]; } Healthy return; } - (Zero) Applicable image: (ID) sender {nslog (@ "character mall button works"); } - (zero) Delok [[Super Delooc]]; } @end  

Finally !!!!!!

I had to keep all the ideas with the initWithFrame and pass it in valid frame retrops. Init should be used to pass UIViews with controllers and initWithFrame!

  characterView = [[see the letter all] initWithFrame: CGRectMake (0, 0, 480, 320)]; Then character Male = [[alphabet alloc] initWithFrame: frame];  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -