nsstring - Help with Xcode drawRect using textfield to input value -


i trying bar graph in xcode. have tried cpgraph , stuff around out of date , need xcode 4. newb , that's why need help.

here code:

-(void)drawrect:(cgrect)rect

{

nsstring *s = textfield.text; value = [s intvalue]; nslog(@"%i",value);       cgcontextref context = uigraphicsgetcurrentcontext();      cgcontextsetlinewidth(context, 60);      cgcolorspaceref colorspace = cgcolorspacecreatedevicergb();      cgfloat components[] = {0.0, 0.0, 1.0, 1.0};      cgcolorref color = cgcolorcreate(colorspace, components);      cgcontextsetstrokecolorwithcolor(context, color);      cgcontextmovetopoint(context, 400, value);     cgcontextaddlinetopoint(context, 400, 100);      cgcontextstrokepath(context);     cgcolorspacerelease(colorspace);     cgcolorrelease(color); 

}

notice have changed 1 of point value "value". have done create uitextfield , want able write 500 in uitextfield , bar adjust itself. nslog tell me value equal 0 if, before building app manually enter number in textfield. have been searching fo 3 days , found give me errors , incomplete says know nothing objective-c in xcode. noticed during search type of line doesn't refresh real time if dont tell him. if that's part of problem. if want more information on code tell me. grateful if can me.

here .h :

@interface draw2d : uiview

{

 uitextfield *textfield; 

}

@property (nonatomic, retain) iboutlet uitextfield *textfield;

@end

ok, looks since have text field hooked in ib file's owner, typically app delegate not class have above uiview. so, not unless changed file's owner uiview text field not hooked up. so, typically add uiview xib window in ib (if not using 1 comes free when create xib). i'll attach text box to, not file's owner. kind of begs question of how attached files owner not unless have uitextfield declared in there (again providing didn't change class app delegate view class).

i know if new is greek. developed in java, c/c++, c#, etc years , learning how program on again.

if new highly suggest iphone dev book big nerd ranch. found useful.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -