Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

iphone - change view's property from method of other class -


i'm trying remotely adjust object myimageview's alphato 0 of myviewcontrollerclass class assistant(it's nsobject subclass).

in assistant.h

#import <foundation/foundation.h>  @class myviewcontroller;  @interface assistant : nsobject {      myviewcontroller *myviewcontroller;     uiimageview *button;  } - (void)adjustalpha:(id)sender;  @property (nonatomic, retain) uiimageview *button; 

in assistant.m

#import "myviewcontroller.h"  @implementation assistant  @synthesize button;  - (id)init  {  self = [super init];  if (self)   {       myviewcontroller = [[myviewcontroller alloc] init];       nslog(@"alloced?: %@", myviewcontroller ? @"yes" : @"no");  }  return self; }  - (void)adjustalpha:(id)sender {      nslog(@"method called");      myviewcontroller.myimageview.alpha = 0; } 

the method did called, myviewcontroller.myimageview.alpha didn't change, why? need fix? thank reading ^_^

edit

this myviewcontroller class:

myviewcontroller.h

@class assistant;  @class myappappdelegate;  @interface myviewcontroller : uiviewcontroller <uitextviewdelegate, uiscrollviewdelegate>  {    uiimageview *myimageview;    assistant *assistant; } @property (nonatomic, retain) uiimageview *myimageview; 

myviewcontroller.m

#import "myviewcontroller.h" #import "assistant.h"  @implementation myviewcontroller  @synthesize myimageview;   - (void)viewdidload  {   [super viewdidload];     assistant = [[assistant alloc] init];     myscrollview = [[uiscrollview alloc] initwithframe:cgrectmake(0,0,320,460);     [self.view addsubview: myscrollview];       myimageview = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"weather.png"]];     myimageview.frame = cgrectmake(19, 54, 48, 48);     myimageview.userinteractionenabled = yes;     [myscrollview addsubview:myimageview];        //this button uses call adjustalpha     assistant.button = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"button.png"]];       assistant.button.frame = cgrectmake(19, 126, 48, 48);     assistant.button.userinteractionenabled = yes; [myscrollview addsubview:assistant.button];      //here how call adjustalpha:     assistant.adjustalphatap =  [[uitapgesturerecognizer alloc] initwithtarget:assistant action:@selector(adjustalpha:)];     [assistant.button addgesturerecognizer:assistant.adjustalphatap];  } 

this question got complex , need experiments, hanging there, make clear when have time. developer met same problems: declare object need access in singleton class, can accessed other classes, , merry christmas!

this work if myimageview declared global scope variable (also called ivar) in .h file of myviewcontroller class , has property of (nonatomic, retain) matching @synthesize in .m.

if sounds you're doing can please post contents of myviewcontroller h , m files.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -