cocoa-touch

Reinitialize a view controller - iPhone

I have a multi view application with individual UIViewControllers and xibs. I have one view that is the game view and every time I call it I want it to re-initialize, by that I mean restart at it's initial condition and not in the state I last left it in. Here is the code block I am using to load and remove views: -(void)loadStartVi...

iPhone No Saved Photo Album created on iPhone

Hi, I am using iPhone 2.0 SDK. I used the API UIImageWriteToSavedPhotosAlbum to save an image. A Saved Photos album gets created on the iPhone Simulator when I save an image but tested on the device the image gets added in the Camera Roll album. While debugging, no errors occur but the Saved Photos album is not created on the device. ...

How to detect iphone is on silent mode.

I am developing one application. In that I want to detect through coding that "is iphone on silent mode or not?". I am developing it by using cocoa with objective-c. If anyone knows it kindly reply. ...

Showing a alertview with a textbox in iPhone

Is it possible to show an alertview with a textbox inside like the AppStore app. It asks for password in such a dialog. I've seen atleast a couple of other third party apps using it. Is it a private API? ...

How can I create dynamically updated views in a tab bar view, based on settings selection?

Hi all, Noob question.... I've created a Tab Bar application. It has four tabs and works fine. Each view is created with a XIB and is effectively static. Each view takes user input and responds on screen. What I need to be able to do is change the input options the user have - in effect remove some UITextFields dependant upon which o...

customizing the keyboard height and width in iphone using objective-c

I want my customized keyboard in iphone with height and width that i want. ...

How can I invoke a method automatically 20 times per second?

From JavaScript I am used to create an interval and specify the delay for re-calling the function, until I stop the interval. Is there something similar available on the iPhone? Any good links are highly appreciated. This goes to community wiki. ...

iPhone 3G: How to show locations around a fixed point?

Hi, I have my current location fixed via CoreLocation. Now I want to get those locations (from an existing database), which are in the near (about 100 feet) of it. How do I start? Update: Here is a implementation of the Haversine formula: http://www.jaimerios.com/?p=39 (very useful) ...

How can I solve this Problem with bidirectional dependencies in Objective-C classes?

Okay, this might be a very silly beginner question, but: I've got an ClassA, which will create an child object from ClassB and assign that to an instance variable. In detail: ClassA will alloc and init ClassB in the designated initializer, and assign that to the childObject instance variable. It's header looks like this: #import <Found...

Why does UIWebView shrink images?

I'm using a UIWebView to display images in base64 (http://www.abluestar.com/utilities/encode_base64/index.php). The UIWebView is set to "Scales Page To Fit" and Mode is "Left". The image might be 400px wide but once rendered in the UiWebView, it takes up not even half of the screen. I need to do something like style="width:800px;..." ...

How to change text on a back button

Hi, By default the back button uses as a text on it a title of a viewcontroller. Can I change text on the back button without changing a title of a view controller? I need this because I have a view controller which title is too long to display and in this case I would like to display just "Back" as a caption for back button. I tried t...

How can I make my Nib load correctly my customized UIScrollView subclass?

I had an nice UIScrollView inside my nib, which worked nicely. Then I had some very special needs and subclassed UIScrollView. In my Nib, I changed the class in the identity inspector to my subclass. But for some reason, my -initWithFrame: method gets never called when the nib loader builds up all those objects from the nib. Actually I ...

In which cases is it a good idea to relinquish using self when accessing instance variables?

This may be a really silly beginner question, BUT: If you have some nice instance variables in your class, such as an UIScrollview *scrollView2 for example, then why should you bypass the getter and setter by relinquishing a [self.scrollView2 addSubview:imageView]; , and rather doing a [scrollView2 addSubview:imageView]; ? I mea...

Objective-C/Cocoa: Properly loading UIViews.

Suppose I have created a UIView, MyView, in Interface Builder, and I have hooked it up (set its File's Owner) to my UIViewController class, MyViewController. Now, I would like to present view. It's just another view, so I don't want to present it as a modal view. How do I go about displaying it? Should I add it as a subview of my win...

Is there any way to get the "Me" card from iPhone Address Book API?

So I'm stumped on this one. In Mac OS X there is an easy way to get the "Me" card (the owner of the Mac/account) from the built-in address book API. Has anyone found a way to find out which contact (if it exists) belongs to the owner of the iPhone? ...

How would you implement the recycling of views during scrolling in an UIScrollView?

Well, there is the delegate that will get called when: the scroll view beginns scrolling the finger liftet of from the scroll view after initializing a scroll-movement the scroll view stopped decelerating but now the problem is, if you want to recycle those View's upon scrolling, you must do that very quickly during scrolling. Someth...

What's the difference between [NSNull null] and nil?

Here's a context where I have seen that: NSMutableArray *controllers = [[NSMutableArray alloc] init]; for (unsigned i = 0; i < kNumberOfPages; i++) { [controllers addObject:[NSNull null]]; } why not nil in that place? ...

UIScrollView displacement

Hi, In my IB I have a navigation controller which has in it a view controller. When I am trying to load this view controller from another navigation controller the scroll view is being displaced by the size of a navigation bar to the bottom. All other elements of my view are not moving except the scroll view. Why does it happen and ho...

Where does a Datasource object belong to? Controller or Model?

I'm implementing a datasource object for an UIScrollView. Is that part of the Controller, or part of the Model? I think Controller, but not sure. It delivers the data. But the data could be in sqlite3, files, from the net. So actually I would say it's not from the Data part, since it should be flexible to from where the data comes. What ...

Adding UiImageView to UiScrollView one at a time... but how?

My problem is that my 300 images are being added to UiScrollView and shows up after it's done finishing with addsubview: calls. How do I set it up so that it adds a subview, who's up on the Screen .. and continue adding ? ...