iphone

Get New Co-Ordinate based on degrees and distance

I have a coordinate from Core Location and want to calculate the co-ordinate given a bearing and a distance, say in km. I think this is the formula from here. http://www.movable-type.co.uk/scripts/latlong.html Formula: lat2 = asin(sin(lat1)cos(d/R) + cos(lat1)sin(d/R)cos(θ)) lon2 = lon1 + atan2(sin(θ)sin(d/R)cos(lat1), ...

Objective-C inheritance problem with UIView

this is my inherited class of UIView : MobileView @interface MobileView : UIView { IconView *icon1; IconView *userCar; id goTimer; } @property (nonatomic, retain) IconView *icon1; @property (nonatomic, retain) IconView *userCar; -(void) goRightInSeconds: (NSInteger)secs; -(IconView *) cannon; @end I also have another cl...

Pause code execution until UIAlertView button is pressed?

One of my methods sends a message to an object (what do you know about that), and expects a BOOL for an answer. However, BOOL answer it is expecting is based on the answer to a UIAlertView created in the receiving object's method. However, the code doesn't pause while waiting for the user to answer the UIAlertView. My problem is: how do ...

Activating UISearchBar upon selecting a Tab Bar Item - Help or Hindrance?

I'm working on an app where I've been asked to add a UITabBarItem to our app's Tab Bar with its own dedicated Search function. This is in addition to the built-in searches already throughout the app (by tapping other UITabBarItems and searching other UITableViews). Now, the first thing that comes to mind is the Apple Human Interface Gui...

Objective C interfaces, delegates, and protocols oh my!!!

So I'm trying to wrap my head around Obj-C interfaces, delegates and protocols. So I have a question: Does a delegate have to be in a separate file or can it be methods defined in your class? Is a protocol like a java interface? This is the way I understand it at the moment where it basically makes you implement methods if you use thi...

IPhone creating a chat application

Hello, I want to create a chat sort of application on the iphone. I know how I would go about implementing a poll model, where the iphone would poll the server to see if any messages have arrived and if they have it can retrieve them and show them to the user. However im more intersted in a push model, where the server pushes new messag...

How to check in an NSAssert of an variable is (null) ?

the console prints me (null) for an variable that should not be, so I want to put an assert there just for fun: NSAssert(myVar, @"myVar was (null)!"); what's the trick here? this (null) thing doesn't seem to be "nil", right? How can I check for it? I want to assume that the var is set properly and not nil, not null. ...

Initial selected Item in an UITabBar without a UITabBarController

Hello, How do I set the default selected UITabBarItem in an UITabBar that is within an UIView, not an UITabBarController? Just to clarify, the UIView does implement the protocol and the didSelectItem method works. At run-time, the tabbar works and the tabbaritems selected when the user touches them. My problem is setting the default s...

Does IPhone development device require an AT&T plan

Just trying to getting things straight before signing up in the development program and paying my $99. I have an older iPhone that we'd like to use for development so I don't have to do anything to my current iPhone. Does the device used for iPhone development require an AT&T plan of any kind. We need data access, but the wifi would s...

How to write a macro that can take a parameter?

I want to use some NSAssert stuff and other things to enable better debugging in my app. NSAssert wants a string which it prints if the assertion fails. Nice, but useless unless you type a whole bunch of information in that string, which can become a big mess when done all over the place. So I want to make a macro that will do the NSAss...

What's the point of NSAssert, actually?

I have to ask this, because: The only thing I recognize is, that if the assertion fails, the app crashes. Is that the reason why to use NSAssert? Or what else is the benefit of it? And is it right to put an NSAssert just above any assumption I make in code, like a function that should never receive a -1 as param but may a -0.9 or -1.1? ...

How to pull up a UIKeyboard without a UITextField or UITextView?

I'm currently developing an OpenGL ES game for the iPhone and iPod touch. I was wondering how I can easily pull up the UIKeyboard? Is there an official, documented possibility to pull up a UIKeyboard without using a UITextField of UITextView? ...

Problem reading values from .plist downloaded from webserver

Hello everyone. My .plist and code to read it is described in http://pastie.org/605082 NSLog(@"Test %@\n",[test valueForKey:@"FirstName"]); returns NULL and resultsRetrieved is not NULL; What could be wrong? ...

How to call a method without an instantiated object

This is an objective-c question. I would like to call a method in an object, but there is no instantiation of the object. Is this possible? The method I want to call is not a class method. ...

Can someone post a full example usage of NSNumber?

I'm not even sure, for example, if I can use it like a normal variable. There doesn't appear to be a mutable version. And does mutable mean it's value can be changed? ...

iPhone - Anyway to get iPhone's Email App Inside Your Own App?

Has anyone every embeded the iPhone's Email program inside your own App? Let me try and simplify that. Tap Tap Revenge allows you to "Challenge A Friend". When you choose to do so they open the standard iPhone email program (if they mimicked it, it looks damn good), within the application with pre-populated data. All you have to do i...

How to debug OpenGL ES crashes?

OpenGL ES 1.1 likes to crash my iPhone program if anything goes slightly wrong. Usually it happens somewhere inside glDrawArrays, with several glDestroyContext calls on stack. Usually I'm bisecting the problem by inserting { GLint iErr = glGetError(); if (iErr != GL_NO_ERROR) { NSLog(@"GL error: %d (0x%x)", iErr, iErr); }...

After rotating a CALayer using CABasicAnimation the layer jumps back to it's unrotated position

I am trying to create a falling coin. The coin image is a CALayer with 2 CABasicAnimations on it - a falling down and a rotation one. When the falling down animation gets to its end, it stays there. The rotation animation though, which is supposed to be random and end up in a different angle every time, just pops back to the original CAL...

(iphone sdk) When I use CGAffineTransform (such as CGAffineTransformMakeTranslation) does that actually "move" the frame?

Or does it just change where it's rendered? I have performed this transform and I think the object's frame's origin's y position stays the same. ...

Trying to set tabBarController translucent. But not working. Alpha can be set

I'm using the standard code for setting up my TabBarController, but I can't for the life of me get it to be translucent. I overlay a view with my TabBarController, I would like that image to show through the TBC. Actually I want the bar to just fade away like the Photo app does after a few seconds, but for now, one step at a time. Trans...