objective-c

addObject creates a same value in all array.

I want to add element in the array dynamically. For this I am using [myArray addObject:myword]; myword is a NSMutableString type object. on each button click myword get changes. But all the element of array store the last value. Suppose first time the array has 1 element = "me" Second time array should have 2 element = "me", "you". ...

How to customize the row in the Table view in the iphone sdk?

Hi Guys, I need to customize my table view can anyone help me how to do this. Actually I am having three sections in my tableview each one has one row and I want to make the third section row as an rounded rectangular of size 50 x 50. Please guys help me how to do this...!! Thanks in advance, Monish. ...

MessageComposeResult is sent even if the message send failed

Hi everyone, I am using MFMessageComposeViewController to send sms within my app. Everything is correct until i try to get the result of the operation. Actually the Message sending failed as It can be seen in the SMS native app (I have no service in the sim card), but I get MessageComposeResultSent in - (void)messageComposeViewController...

Passing variables (or similar) to newly loaded view

Hi All, I am loading new views for a small iphone app, and was wondering how to pass details from one to another? I am loading a tableview full of data from and xml file, then once clicked a new view is brought in via: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { SubInfoViewControll...

Animated moving UIButton not responding to touches/taps while moving

Hi, I'm trying to animate a UIButton to move up the screen. At any point the user can touch it. However, it doesn't seem to respond to touches while moving, only at the start and end of its animation. I guess this is because the button itself isn't moving, just the image of it. Any ideas how I can solve this? Here's my code so far. Thank...

iPhone SDK @package vs. @private vs. @public and struct

Hey I have a really simple question that needs more of just an explanation than a debug, but I have seen in the interface definitions for many class objects the keywords "@package", "@private", "@public", and then even weirder "struct {...}". I have been able to make complete programs without using any of the aforementioned, so I was hop...

only show keyboard when certain text field is tapped on ipad?

I need to move the view up when the keyboard is shown but only for 1 textfield at the bottom of my view, I thought it would be as easy as checking for isFirstResponder but no such luck - here is what I was trying: if ([notes isFirstResponder]) { [UIView beginAnimations:@"moveupcontrols" context:nil]; [UIView setAnimationDuratio...

Objective C : calculate and display time to millisecond

Full Disclosure: I am a mathematical moron int hours = totalSeconds / (60 * 60); int minutes = (totalSeconds / 60) % 60; int seconds = totalSeconds % 60; //int milliseconds ??? calculatedExposureTime.text = [NSString stringWithFormat:@"%02d:%02d:%02d:%02d", hours, minutes, seconds, milliseconds]; Say totalSeconds was a fraction of a s...

How to use containsObject in NSMutableArray

Hi everyone, I am trying to find if there is any object in the mutable array that matches with the object I pass. Please see the function below. The name comes from table view controller, so the row that is tapped is saved into name and passed to this function. I am trying to check whether the name in the table view controller equals t...

iphone sdk: CGAffineTransform not working in iOS 4???

hi everyone, i'm using the following code to move a uialertview with a uitextfield in it. The alertView is supposed to slide up when the keyboard appears and slide backdown as soon as it dissappears. The following code worked perfectly fine for me under ios 3.1.2. But for some reason it does not work under ios 4.0..... The issue seems t...

Email auto responder - objective-c

Ok I want to do this: If an email comes in to [email protected], it looks at the email's fields. For example: Name:elijah wood Address:77 apple avenue And enters that data into an address book contact. Depending on the fields someone might have sent in a "price quote" or a "brochure request". Like this: If this field is present ...

Concatenate one NSMutableArray to the end of another NSMutableArray.

Hello everyone! A simple answer to this super simple question would be great! Here is the pseudcode: NSMutableArray Africa = [Lion, Tiger, Zebra]; NSMutableArray Canada = [Polar Bear, Beaver , Loon]; NSMutable Array Animals = Africa + Canada; What I want to end up with: Animals = [Lion, Tiger, Zebra, Polar Bear, Beaver, Loon]; Wh...

Cocoa Createfileapath

hello, I am trying to create a file on mac os. the data from the file will be accessed by the app. but how to create a file having read permission on all accounts. Currently the app can read data in admin account only. I am using following syntax: BOOL B = [fm createFileAtPath:p1 contents:data attributes:nil]; is it something to do w...

Help with endianness?

Hey guys I learned about endianness and am still having difficulty understanding where things could go wrong. I was wondering what sort of things I should look for and how I should go about fixing it. I know I dont need to change anything for loading from text files and things like that but for example here is a snippet of my code for lo...

Objective-C use ASIHttp libraries to manage HTTP authentication requests

Hello all, So I am trying to connect to my company's website through an HTTP authentication request. The problem is, in order to validate, it has to go through a series of redirects and gather 2 cookies along the way. Does anyone know if the ASI libraries found here have a way of handling this sort of thing? For example, does the r...

NSDictionary : How to filter by match or closest value

How would I search my dictionary for the closest value to the query? Say I search for 0.000475, I know it's not available but I want to return it's closest value 0.000500. I suppose I would use keysOfEntriesPassingTest to achieve this on a dictionary, clueless on how to go about it though. <key>1/8000</key><real>0.000125</real> <key>1...

Does "self.propery = [[SomeClass alloc] init];" leak memory?

Is it safe in Objective-C to write self.propery = [[SomeClass alloc] init]; instead of SomeClass *tmp = [[SomeClass alloc] init]; self.property = tmp; [tmp release]; or will the first form leak memory? ...

Printing Errors to a File in Cocoa/ Objective-C

Hello Fellow Computer People! Anyone willing to help will have my gratitude ;) Just wondering what is the best approach to printing errors to a file i.e. so that if my executable crashes I can have a record of what happened. This would be in Cocoa, Objective-C or C. Thanks, Eric PS. I hope my question is not too general or vague. ...

How to store molecules in memory?

I want to store molecules in memory. These can be simple molecules: Methane (CH4) C-H bond-length: 108.7 pm H-H angle: 109 degrees But also more complex molecules, like paracetamol (C8H9NO2): How can I store molecules in memory, including all bond-lengths and angles? A good idea to store atom-structs in an array? Or is there a be...

Getting wrong date with initWithTimeInterval: sinceDate:

Hi, I have a date, 2010-08-23 13:30:00 -0400 and I'm trying to get it in the UTC +2 time zone. The difference in seconds is 21600 but when I call [[NSDate alloc] initWithTimeInterval:interval sinceDate:sourceDate];, I get 2010-08-24 01:30:00 +0200 which should be 2010-08-23 19:30:00 +0200. Any idea what I'm doing wrong? ...