I am working on porting a Java codebase to Cocoa/Objective-C for use on desktop Mac OS X. The Java code has lots and lots of methods with checked exceptions like:
double asNumber() throws FooException {
...
}
What's the best way to represent these in Objective-C? Exceptions or error out-parameters?
- (CGFloat)asNumber {
... ...
Ok, I haven't programmed in C# before but I came upon this code and was wondering what it does. Now, I now that it just searches and find the first occurrence of "." and replaces it with "" but what exactly is in the ""? Would this just delete the period or is there a space character that replaces the "."? I'm trying to figure out how to...
Hi,
I have a view controller and I want to host a UITabBar on it. When the user clicks on different tab items, I want to show different views. I have this working, but it's hard to maintain.
In InterfaceBuilder, I simply created all my tab views, hide them. In my project, when the user clicks on one of the tab items, I simply set the h...
I have an iphone app, it run some thread to compute search. The search is made calling a time consuming function from a library.
I need to exit from the thread when the app is terminating, otherwise the thread continue to run and the search create problem when i reopen the app.
I tried to subscribe in the thread
[[NSNotificationCen...
Is there a way to select a fixed number of random entries from a Core Data store? I am just getting started with Core Data and have been stuck on this problem for quite some time.
As a last resort, I could query a large selection of entries into memory and then randomly select a fixed number.
Also, is there a way to specify custom SQL...
I have a two-dimensional C array of Objective-C objects. How do I access the members of those objects?
id array[5][5];
array[0][0] = [[Ball alloc] init];
The Ball class has two members:
int size;
CGPoint point;
How can I access size for the Ball object stored in array[0][0]? Please tell me how I can do this.
Thanks in advance!
...
Is there any way to define relationship among tables and give foreign keys among them while using sqlite in Objective c
...
Hi,
I am having an issue with updating the contents of an "myInfoBox" object I created to be displayed while some background processes are done.
In the delegate method I am creating a new viewController:
-(void)loadMainView
{
myFirstViewController = [[MyFirstViewController alloc] initWithNibName:@"MyFirstView" bundle:nil]; ...
I'm developing an iPhone app, and I'm kinda new to Objective-C and also the class.h and class.m structure.
Now, I have two classes that both need to have a variable of the other one's type. But it just seems impossible.
If in class1.m (or class2.m) I include class1.h, and then class2.h, I can't declare class2 variables in class1.h, if ...
Ok, I have this prototype that was written by someone else in C# and I'm trying to put it into Objective-C. Now, I haven't had any formal experience with C# yet, so I don't know everything about it yet. I understand what the first three variables are, but I'm running into problems with what the fourth and fifth lines (c_data) are doing. ...
I would like to write some Objective-C code for distribution. What is the best way to package up the output. In Java you can package up your code in a JAR file and distribute that. What would be the equivalent in Objective-C?
The following link is close, but seems to address more of the namespace issues which I am not concerned about. I...
I'm working on an iPhone application which will use long-polling to send event notifications from the server to the client over HTTP. After opening a connection on the server I'm sending small bits of JSON that represent events, as they occur. I am finding that -[NSURLConnectionDelegate connection:didReceiveData] is not being called un...
Ok, so I have the code below (Objective-C FYI) and I was wondering if I want to create an NSMutableArray of c_data objects, how would I go about doing that? It's sort of like declaring a List<c_data> cData in C#.
@interface c_data : NSObject {
double value;
int label;
int ID;
}
@property double value;
@property int label...
I would like to implement a view (it will actually be going into the footer of a UITableView) that implements 1-3 buttons. I would like the layout of these buttons (and the size of the buttons themselves) to change depending on which ones are showing. An example of almost the exact behavior I would want is at the bottom of the Info scree...
I am writing some objective-C code and i can't figure out why this does not work:
buttonRect = CGRectMake(0,0,100.0,100.0);//error:incompatible types in assignment
CGRect newFrame = CGRectInset(buttonRect, -0.2, -0.2);//error:incompatible type for argument 1 of CGRectInset
button.frame = newFrame;
buttonRect is a CGRect defined as an ...
Hi all,
I recently started compiling my iPhone application against the 3.0 OS. The app worked fine when compiled against 2.2.1 however, compiling against 3.0 yields the following warning:
warning: type 'id
' does not
conform to the 'UIActionSheetDelegate'
protocol
This occurs on the 2nd line of the following code snippet whi...
For some reason, none of my UITextFields will autocapitalize. I have set the property in InterfaceBuilder as well as programatically as shown below.
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"search_cell"];
UITextField *tf = [[UITextField alloc] initWithFrame:CGRectMake(12, 10, 320, 32)];...
I have a view that gets used in each of my CollectionView's items. I have an IBOutlet to the CollectionViewItem from my view and I have that hooked up in Interface Builder. I want to access a value from the representedObject (which is a Core Data object) in my view code. Here is an example of what I'm trying to do -- access a sequence...
Every 1/16 of a second, I have an NSTimer that fires, calling a method each time. I want to create a static integer that is increased by '1' each time the method is called, once the static integer is equal to '16', I wish to call another method and reset the static integer to '0'.
Any insight is greatly appreciated. (Language is Obj-C)...
If i want to divide world in four quadrants and make regions in these quadrants and wanna find the distance from my location to a point in the region I am standing, how is it possible in iPhone using objective c? Or any other solution possible
...