Search Results

Search found 91 results on 4 pages for 'tattat'.

Page 1/4 | 1 2 3 4  | Next Page >

  • iPhone MKMapView : the map can’t load completely.

    - by Tattat
    I don't know what's make wrong, my map can load, but the image on the map is not completely load. plx help. thz a lot. Here is the simulate map from the iPhone: (Added more example image.) http://img689.imageshack.us/img689/8476/screenshot20100309at841.jpg Here is the code: MKCoordinateRegion theRegion; MKCoordinateSpan theSpan; theSpan.latitudeDelta = 0.005; theSpan.longitudeDelta = 0.005; theRegion.center =  manager.location.coordinate; theRegion.span = theSpan; myMap.scrollEnabled = YES; myMap.zoomEnabled = YES; [myMap setRegion:theRegion]; [myMap regionThatFits:theRegion];

    Read the article

  • How to let the CCSprite handles Touch event?

    - by Tattat
    I created my OwnCCSprite, and it get the implemented CCStandardTouchDelegate protocol, and ccTouchesBegan event. But it seems not working. When I click the CCSprite, the ccTouchesBegan in the CCLayer is called, but the CCSprite's ccTouchesBegan can't called. How can I detect the CCSprite is being touched in CCLayer / OwnCCSprite? or I need to calculate the touch position, and compares it to the OwnCCSprite positions? Thz.....

    Read the article

  • What way to use the CGContext to draw is suitable?

    - by Tattat
    I know that the CGContext cannot call it to draw directly, and it needs to fill the drawing logic in the drawInContext, and call the CGContext to draw using "setNeedsDisplay", so, I designed a cmd to execute, but it cause some problems... like this : http://stackoverflow.com/questions/2617827/why-i-cant-draw-in-a-loop-using-uiview-in-iphone I think the CGContext is very different from my previous programming experience....(I used HTML5 canvas, that allow me add more details, after I draw, so do the Java Swing) Actually, I want to know what is the suitable to implement these kind of thing in Apples' programmer mind. Thz.

    Read the article

  • Why the CCLayer can't use a for loop in draw method??

    - by Tattat
    I have a CClayer, that have a draw method, every second, it will call the draw method 60 times. So, I have method like this: -(void)draw{ glEnable(GL_LINE_SMOOTH); glColor4f(0.0f, 1.0f, 0.0f, 1.0f); glLineWidth(5.0f); ccDrawLine(ccp(300,20), CGPointZero); } I work great. but after I added a for looop, for example....: -(void)draw{ glEnable(GL_LINE_SMOOTH); glColor4f(0.0f, 1.0f, 0.0f, 1.0f); glLineWidth(5.0f); ccDrawLine(ccp(300,20), CGPointZero); for(int i=0; i<5; i++){ NSLog(@"Testing the loop, %i", i); } } It can't draw anything, the screen only black. But I can see the Testing the loop is keep calling.... Why? thank you.

    Read the article

  • Why there is an invalid context error?

    - by Tattat
    Here is the code I use to draw: - (void) drawSomething { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetRGBStrokeColor(context, 1, 0, 0, 1); CGContextSetLineWidth(context, 6.0); CGContextMoveToPoint(context, 100.0f, 100.0f); CGContextAddLineToPoint(context, 200.0f, 200.0f); CGContextStrokePath(context); NSLog(@"draw"); } But I got the error like this: [Session started at 2010-04-03 17:51:07 +0800.] Sat Apr 3 17:51:09 MacBook.local MyApp[12869] <Error>: CGContextSetRGBStrokeColor: invalid context Sat Apr 3 17:51:09 MacBook.local MyApp[12869] <Error>: CGContextSetLineWidth: invalid context Sat Apr 3 17:51:09 MacBook.local MyApp[12869] <Error>: CGContextMoveToPoint: invalid context Sat Apr 3 17:51:09 MacBook.local MyApp[12869] <Error>: CGContextAddLineToPoint: invalid context Sat Apr 3 17:51:09 MacBook.local MyApp[12869] <Error>: CGContextDrawPath: invalid context Why it prompt me to say that the context is invalided?

    Read the article

  • NSMutableArray count method show the NSMutableArray is count 0?

    - by Tattat
    This is my init method: -(id)init{ self = [super init]; magicNumber = 8; myMagicArray = [[NSMutableArray alloc] initWithCapacity:(magicNumber*magicNumber)]; NSLog(@"this is the magic Array: %d", [myMagicArray count]); return self; } This is the .h: @interface Magic : NSObject { NSMutableArray *myMagicArray; int magicNumber; } The console shows me that number is 0. instead of 64, wt's happen? I already check out this post: StackOverflow Link: http://stackoverflow.com/questions/633699/nsmutablearray-count-always-returns-zero

    Read the article

  • How to do parsing in Objective C?

    - by Tattat
    In Java, I can easily pass data using (ObjectA)objB. How can I do the similar things in Objective C? Also, why the Objective C can't return an Object, but only can return the id only? I do -(MyObj)returnMyObject{ }, but the Xcode warning me that I can't use the MyObj, but I can return the id..... -(id) returnMyObject {}.

    Read the article

  • Which design is better?

    - by Tattat
    I have an "Enemy" object, that have many "gun" . Each "gun" can fire "bullet". Storing "gun" is using an array. when the "gun" is fired, the "bullet" will be created. And the enemy object will have an array to store the "bullet". So, I am thinking about the fire method. I am think making a firebulletFromGun in the "enemy". It need have a parameter: "gun". while this method is called. The "enemy" 's bullet will be added in the Array. Another design is writing the fire method in the "gun". The "enemy" use the "gun"'s fire method. And the "gun" will return a "bullet" object, and it will be added in the Array of "enemy". Both method can work, but which way is better? or they are similar the same? plx drop ur ideas/suggestions. thz.

    Read the article

  • Best practice to pass a value from pop over control on iPad.

    - by Tattat
    It is an iPad app based on SDK 3.2. I have a MainUIView, that is subclass from UIView, it have a UIButton and a UILabel. When user press the UIButton, the pop over control will be appeared with a table view. When the user select a cell from the table view, the UILabel changes content base on the user click, and the pop up table view will disappear. The question is, how can I pass the "selected cell" to the UILabel. I am thinking making a "middle man" object. When the user click the UIButton, and the "middle man" will pass to the table. When the cell is selected, the "middle man" will store the idx, and call the UILabel change content from the value of "middle man". But I think it is pretty complex to implement, is there any easier way to implement it? thz u.

    Read the article

  • Why I add the CGPoint in the NSMultable Array?

    - by Tattat
    I want to store my CGPoint to the NSMultable Array, so , I have method like this: [self.points addObject:CGPointMake(x, y)]; But I got the error, it said that : Incompatible type for argument 1 of "addObject". So, I check out the API, (void)addObject:(id)anObject anObject The object to add to the end of the receiver's content. This value must not be nil. So, I think the "CGPointMake" can make a Object, but it can't be assigned. What happens?

    Read the article

  • Why I can't update my UIImageView?

    - by Tattat
    I make my own UIImageView, like this: @interface MyImageView : UIImageView{ } And I have the initWithFrame like this: - (void)initWithFrame{ UIImage *img = [UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource:@"myImage" ofType:@"png"]]; CGRect cropRect = CGRectMake(175, 0, 175, 175); CGImageRef imageRef = CGImageCreateWithImageInRect([img CGImage], cropRect); self = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 175, 175)]; self.image = [UIImage imageWithCGImage:imageRef]; [self addSubview:imageView]; CGImageRelease(imageRef); } I want to change the image when the user touchesBegin, so I have something like this: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UIImage *img = [UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource:@"myImage2" ofType:@"png"]]; CGRect cropRect = CGRectMake(0, 0, 175, 175); CGImageRef imageRef = CGImageCreateWithImageInRect([img CGImage], cropRect); self = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 175, 175)]; [self setImage:[UIImage imageWithCGImage:imageRef]]; CGImageRelease(imageRef); } I find that I can't change the image. So, I add a line [self addSubview:imageView]; in the touchesBegan method, that's work. But I have no idea on why I can't change the image from the touchesBegan, thz.

    Read the article

  • How to simply this logic/code?

    - by Tattat
    I want to write an apps that accepts user command. The user command is used in this format: command -parameter For example, the app can have "Copy", "Paste", "Delete" command I am thinking the program should work like this : public static void main(String args[]){ if(args[0].equalsIgnoreCase("COPY")){ //handle the copy command } else if(args[0].equalsIgnoreCase("PASTE")){ //handle the copy command }/** code skipped **/ } So, it works, but I think it will become more and more complex when I have more command in my program, also, it is different to read. Any ideas to simply the logic?

    Read the article

  • Why my own UIViewController can't detect touch?

    - by Tattat
    I have my OwnViewController, the viewDidLoad is like this: - (void)viewDidLoad { [super viewDidLoad]; UIImage *img = [UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource:@"myImg" ofType:@"png"]]; CGRect cropRect = CGRectMake(175, 0, 175, 175); CGImageRef imageRef = CGImageCreateWithImageInRect([img CGImage], cropRect); UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 175, 175)]; imageView.image = [UIImage imageWithCGImage:imageRef]; self.view = imageView; CGImageRelease(imageRef); } It works, and I have detect touches method like this: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"touchesBegan"); } But my UIView can't detect any touches. My Own UIViewController is a subclass of UIViewController. It is a little square view on the IB, why that can't detect touches? thx u.

    Read the article

  • Why I got some memory problems?

    - by Tattat
    I got this error from XCode: objc[8422]: FREED(id): message release sent to freed object=0x3b120c0 I googled and find that is related to the memory. But I don't know which line of code I go wrong, any ideas? @implementation MyAppDelegate @synthesize window; @synthesize viewController; - (void)applicationDidFinishLaunching:(UIApplication *)application { // Override point for customization after app launch [window addSubview:viewController.view]; [window makeKeyAndVisible]; [self changeScene:[MainGameMenuScene class]]; } - (void)dealloc { [viewController release]; [window release]; [super dealloc]; } - (void) changeScene: (Class) scene { BOOL animateTransition = true; if(animateTransition){ [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.5]; [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:window cache:YES]; //does nothing without this line. } if( viewController.view != nil ) { [viewController.view removeFromSuperview]; //remove view from window's subviews. [viewController.view release]; //release gamestate } viewController.view = [[scene alloc] initWithFrame:CGRectMake(0, 0, IPHONE_WIDTH, IPHONE_HEIGHT) andManager:self]; //now set our view as visible [window addSubview:viewController.view]; [window makeKeyAndVisible]; if(animateTransition){ [UIView commitAnimations]; } }

    Read the article

1 2 3 4  | Next Page >