objective-c

Selection on table view causes parent view to change

Hi there, I'm working on an iPad app and here's my scenario: I have a view which contains a table view inside of it. When the user selects an item on the table view, I would like the parent's view to change in a navigational manner. For those of you that have an iPad, this would be akin to the "Settings" app. But I guess in the "Sett...

Weird IF THAN not working with Requested data from URL text problem

Hey all, i am checking for an internet connection by checking for a file on my server. The file only has the word LIVE displayed on the page. No HTML or anything else is there, just the word LIVE. When i run this code, i do get the NSLog as saying "LIVE" but once i go to check it with the IF statement, it fails and i just do not know wh...

UIImage - should be loaded with [UIImage imageNamed:@""] or not ?

Hello ! every one. I am having number of images with in my application. ( images more than 50 - approximately & it can extend according to client's need ) Each image are very large round about - 1024 x 768 & 150 dpi Now, I have to add all this images in a scroll view & display it. Ok, My question is as follows. According to me there...

cannot convert 'b2PolygonShape' to 'objc_object*' in argument passing

Hey there, I am not sure if many of you are familiar with the box2d physics engine, but I am using it within cocos2d and objective c. This more or less could be a general objective-c question though, I am performing this: NSMutableArray *allShapes = [[NSMutableArray array] retain]; b2PolygonShape shape; .. .. [allShapes addObject:sha...

Refcounted pointers on iPhone

1) Refcounted pointers need stack variables to have constructors / destructors called at predictable places. 2) Objective-C, afaik, does not support the above. 3) The cocoa libraries are bound in Objective-C, not C++. Thus, my question: is there a easy way to use the Cocoa libraries, yet still have most of my app in C++ (and thus use ...

How does one populate the results of an UIImagePicker with some "default" images (if the user has none of their own to choose from)

How does one populate the results of an UIImagePickerController with some "default" images. In this case I have made a photo manipulation app where the user selects an image from their library, but I'd like to give them sample images without actually saving them to their libraries. Is there some way to manually inject my default images i...

iPhone Game Having a statement checked every 50 points

Hello! I've run into a little hurdle and wanted to see if somebody could help me! I want to write an algorithm for an if statement that says: if (for every 50 points) { //do something } I thought += 50 would do the trick, but nope. Any ideas? Thanks! ...

Generate non-repeating, no sequential numbers

how does one use code to do this: produce 15 random numbers [EDIT: from 1 - 15] that are not in any order, and that only occur once eg. 1 4, 2, 5, 3, 6, 8, 7, 9, 10, 13, 12, 15, 14, 11 rand() or arc4rand() can repeat some, which is not what im after. Thanks ...

iPhone: AppStore InAppPurchase Connects in Simulator but Not on Device

I am having trouble connecting to the AppStore from within my application. Everything runs fine in the Simulator but when I run on device the app cannot connect to the Appstore. Here is the code that connects to the Appstore #import "BuyController.h"#import "InAppPurchaseManager.h" #import "SKProducts.h" #define kInAppPurchaseProUpgrad...

Equivalent of CGPoint with integers?

Cheers, I like strict typing in C. Therefore, I don't want to store a 2D vector of floats if I specifically need integers. Is there an Apple-provided equivalent of CGPoint which stores data as integers? I've implemented my type Vector2i and its companion function Vector2iMake() à la CGPoint, but something deep in me screams that Apple ...

call the function(InApp Purchase)

how can we call the defined function on button action in objective-c on iPhone. for example: we define the function as follow -(void)abc { // } now how can i call this function on the button action ...

Can I separate merged model into source parts?

Can I separate merged model into source parts? Need to do it for reason of upgrade to new versions my every or not every source part of db. It must work under 10.5, so i cant use inferredMappingModelForSourceModel. ...

UISegmentedControl tint color on touch

Hey everyone, I have a UISegmentedControl in my app (see code below) : // --------------- SETTING NAVIGATION BAR RIGHT BUTTONS NSArray *segControlItems = [NSArray arrayWithObjects:[UIImage imageNamed:@"up.png"],[UIImage imageNamed:@"down.png"], nil]; segControl = [[UISegmentedControl alloc] initWithItems:segControlItems]; segControl.s...

Non-deprecated replacement for NSCalibratedBlackColorSpace?

I'm implementing my own NSBitmapImageRep (to draw PBM image files). To draw them, I'm using NSDrawBitmap() and passing it the NSCalibratedBlackColorSpace (as the bits are 1 for black, 0 for white). Trouble is, I get the following warning: warning: 'NSCalibratedBlackColorSpace' is deprecated However, I couldn't find a good replacement...

How can I configure Xcode to put '{' where I want it in generated files

I know this is a fairly contentious issue amongst programmers, but when developing I like my IDE to position the opening curly bracket underneath the method/interface/control declaration, for illustrative purposes: - This is how Xcode automatically generates skeleton methods with the { at the end: - -(void) isTrue:(BOOL)input { if(...

How to add numbers in a mutable array in iphone?

I am new to iphone development.I want a Nsmutable array to hold numbers from 1 to 100.How i can do it.how can i implement in a for loop.Is there any other way to hold numbers in array in iphone.Please help me out.Thanks. ...

Can I move the order of XCode, Cocoa, and User Templates around in XCode 3.1?

I followed the other questions on StackOverflow and made custom User Templates. Instead of replacing the factory default Cocoa class template, I have to pick a new user template. The order that is shown in XCode's New File dialog box is: iPhone templates first (great if you mostly do iphone development) Second the User templates Thir...

obj-c problem setting array with componentsSeperatedByString

I have a data source with about 2000 lines that look like the following: 6712,Anaktuvuk Pass Airport,Anaktuvuk Pass,United States,AKP,PAKP,68.1336,-151.743,2103,-9,A What I am interested in is the 6th section of this string so I want to turn it into an array, then i want to check the 6th section [5] for an occurrance of that string "PA...

trying to draw scaled UIImage in custom view, but nothing's rendering

I've created a custom view class and right now just want to draw an image scaled to fit the view, given a UIImage. I tried just drawing the UIImage.CGImage, but as others have attested to on this site (and in the docs), that renders the image upside down. So, at the suggestion of an answer I found to another question, I'm trying to dra...

Issue with UITextView in an animation block

I'm having an issue with a UITextView inside another UIView whose frame is manipulated in an animation block when the keyboard displays. During the animation block the UIView scales beautifully and as expected, but the UITextView jumps out of it's superview(the UIView being animated) at the start of the animation. By the end of the ani...