Hi , I got a problem here , problem is with drawRect: method , i am using UIViewController class in which i have one PolygonView instance . I already added this as an outlet in nib file , now what when i am trying to unwrap CGPoints from NSValue ,which i got from NSArray i could not get that value . warning: Unable to read symbols from "UIKit" (not yet mapped into memory). warning: Unable to read symbols for "/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics" (file not found).
My Code is :------------ UIViewController class // // HelloPolygonViewController.m // HelloPolygon // // Created by MOHIT JOSHI on 7/2/09. // Copyright SDSU 2009. All rights reserved. // #import "HelloPolygonViewController.h" #import "PolygonShape.h" @implementation HelloPolygonViewController /* // The designated initializer. Override to perform setup that is required before the view is loaded. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { // Custom initialization } return self; } */ /* // Implement loadView to create a view hierarchy programmatically, without using a nib. - (void)loadView { } */ // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; } /* // Override to allow orientations other than the default portrait orientation. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationPortrait); } */ - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview // Release anything that's not essential, such as cached data } - (IBAction)increase:(id)sender { //numberOfSidesLabel.text.integerValue = numberOfSidesLabel.text.integerValue+1; [polygonShape numberOfSides:numberOfSides.text.integerValue+1]; numberOfSides.text =[NSString stringWithFormat:@"%d",[polygonShape numberOfSides]]; [self setNumberOfsides:[polygonShape numberOfSides]]; } - (IBAction)decrease:(id)sender { // numberOfSidesLabel.text.integerValue = numberOfSidesLabel.text.integerValue-1; [polygonShape numberOfSides:numberOfSides.text.integerValue-1]; numberOfSides.text =[NSString stringWithFormat:@"%d",[polygonShape numberOfSides]]; [self setNumberOfsides:[polygonShape numberOfSides]]; } -(void)setNumberOfsides:(int)side { NSMutableArray *valueArray =[polygonShape pointsForPolygonInRect:[polyView bounds] numberOfSides:side]; //NSValue *values; CGPoint cgPoints; [polyView pointsArray:valueArray]; NSLog(@"here"); [polyView setNeedsDisplay]; /* for(NSValue *values in valueArray) { NSLog(@"here:%@",values); //NSLog(@"Values:%@",[values CGPointValue]); cgPoints=[values CGPointValue]; NSLog(@"%f n %f",cgPoints.x,cgPoints.y); [polyView points:cgPoints]; [polyView numberOfSides:side]; } for(int i=0;i<=side-1;i++) { //values=[valueArray objectAtIndex:i]; for(NSValue *values in valueArray) { NSLog(@"here:%@",values); NSLog(@"Values:%@",[values CGPointValue]); } }*/ //CGPoint cgPoints=[values CGPointValue]; NSLog(@"wat up!"); } -(void)awakeFromNib{ [polygonShape maximumNumberOfSides:12]; [polygonShape mininmumNumberOfSides:3]; CGRect rect = CGRectMake(40.0,80.0,200.0,300.0); polyView =[[PolyView alloc]initWithFrame:rect]; //polyView=(PolyView*)self.view; //[self.view addSubview:polyView]; [polyView numberOfSides:[polygonShape numberOfSides]]; //[polyView bound:rect]; //CGRect rect = CGRect(20.0,40.0,100.0,200.0); //[polyView } - (void)dealloc { [polygonShape release]; [PolyView release]; [super dealloc]; } @end /************************/ Cutomize UIView class is // // PolyView.m // HelloPolygon // // Created by MOHIT JOSHI on 7/2/09. // Copyright 2009 SDSU. All rights reserved. // #import "PolyView.h" @implementation PolyView @synthesize numberOfSides; @synthesize pointsArray; -(void)numberOfSides:(int)sides { numberOfSides=sides; NSLog(@"sides"); } -(void)bound:(CGRect)rect { bound=rect; NSLog(@"bound:%@",bound); } - (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { // pointsArray =[[NSMutableArray alloc]init]; NSLog(@"init"); //bounds=frame; //NSLog(@"%@",frame); } return self; } -(void)pointsArray:(NSMutableArray*) tempArray { pointsArray=tempArray; NSLog(@"here2:%@",pointsArray); //for(NSValue *value in pointsArray) } -(void)points:(CGPoint)pointArray { points=pointArray; //[pointsArray addObject:points]; } -(NSMutableArray*)point { return pointsArray; } - (void)drawRect:(CGRect)rect { // Drawing code CGRect bounds =[self bounds]; CGContextRef context= UIGraphicsGetCurrentContext(); CGContextBeginPath(context); //NSLog(@"%@",points); NSLog(@"polyview:%@",self); if([ self point]!= NULL) { NSLog(@"%@",[self point]); //*PROBLEM IS HERE CAN NOT GET POINTS ARRAY* NSLog(@"h"); for(NSValue *value in pointsArray) //* PROBLEM IS HERE CAN NOT GET POINTS ARRAY* { NSLog(@"i"); points =[value CGPointValue]; NSLog(@"%f n %f",points.x,points.y); CGContextMoveToPoint(context, points.x, points.y); CGContextAddLineToPoint (context,points.x,points.y); } //CGContextAddLineToPoint (context, 260, 250); CGContextClosePath (context); [[UIColor redColor] setFill]; [[UIColor blackColor] setStroke]; CGContextDrawPath (context, kCGPathFillStroke); NSLog(@"%@",bounds); [[UIColor grayColor]set]; UIRectFill(bounds); } NSLog(@"I am here:%d",numberOfSides); } - (void)dealloc { [pointsArray release]; [super dealloc]; } @end _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com