objective-c

Is it slow on the iPhone to do a lot of mallocs and frees?

Hey guys, I was working on some particle systems and this was the only way I could figure out to set up the arrays: if (vertices){ free(vertices); } if (textures){ free(textures); } vertices = malloc(sizeof(point3D) * 4 * [particles count]); textures = malloc(sizeof(point2D) * 4 * [particles count]); The particles constantly ...

Question about UIWebView for use in my help screen

So I made a UIWebView and I had it read a local help.html file. This is for my app's help screen. Now my question is two-fold: if I say have a link in there to go to either my website or something then people click that link and it's within the uiwebview! How would I go about launching safari instead? target='_blank' doesn't seem to ...

UIActivity Indicator- load views

Hi, I am trying to add some titles to my project. So, when my app gets loaded it should show my title screen with activity indicator spinning and after 3seconds it should push the navigation controller. Basically I will have an image on the first view controller. So, in IB I added an image view and set the image. Please help me guys how...

How to get the active view in an iOS application from the app delegate?

Hi - how can i get the currently active view (the main view currently being viewed by the user) from the app delegate for references sake? ...

iOS using External Object in Nib

I am writing an application that needs to interfaces with different backend systems. I decided to use a Protocol in order to abstract my backend Classes. I created a nib called LoginViewController that contains an "External Object" reference of type "NSObject", and wired it to the systemDelegate outlet in my LoginViewController. @interf...

running several background threads in succession on iphone / ipad

I have to download a ton of images and I am doing it on a background thread, problem is all of the downloaded data is not released until I go back to the main thread which is fine a for couple hundred images but when I get into thousands the app runs out of memory and crashes. So I need to run several background threads in succession so...

Adding a TableViewController to an existing table view

Hello, I've got a Table view and it's the child of the View ( see the IB hierarchy ) : I want to start customizing the tableCells, so I assume I'll have to add a tableViewController . Where would I start in this instance ? the TableViewcontroller can't be a child of the MainViewController, can it ? Cheers, ...

iPhone Google Analytics - identifying unique users

Hi there, I'm in the process of adding Google Analytics to my iPhone app, but I'm not at all experienced with Analytics. One thing I would like it to tell me is how many unique people are using the app. Suppose one user were to use her iPhone app on ten different wireless networks, would Google Analytics iOS SDK interpret this as ten d...

Can postNotificationName be used to call a previous view?

I'm trying to have a "Cancel" button send the user to the previous view in my iPhone app. Can postNotificationName be used to do this? How can I define the previous view? Thanks in advance! ...

importing .csv files into SQlite through objective C

Hello everyone, I am able to import .csv files into a SQlite table through the command line. It works nice and fine. What i wanted to know was is it possible to do the exact same thing through Objective C code..meaning execute commands like .mode csv && .import file.csv table. The interface sqlite3 does all normal SQL statement executio...

Accessors / Getters and Lazy Initialization

I have a question about overriding auto-generated accessor methods. The following would not work (I believe) because each getter references the other getter. Is there a rule that accessor methods should not use other accessor methods, or do you just have to watch out for these situations individually? -(UIImage *) image{ if(image...

Resizing to fit an Image in a TableView Cell

Hello, I`m using an Image that is 320x30 using this code : UIImageView *bg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"higlight_cell_mockup.png"]]; [bg setContentMode:UIViewContentModeScaleAspectFit]; cell.backgroundView = bg ; Problem is, it's still looking like this : instead of scaling the image up to fill the cell...

how to convert data to mp4 format

Hi, in my apps im able downloaded a short video file from my server using NSURLConnection but the data i received is in data format which cannot be played using MPMoviePlayerViewController. My question is: it is possible to convert NSdata to mp4 file? and how do i play it using MPMoviePlayerViewController. would really appreciate some co...

From where I can get some coding help for Nimbuzz for iPhone like application?

Hi Everybody, I am trying to develop an application just like the Nimbuzz application for iPhone. Can any point me to some useful sites from where i can get help regarding the same. I would like to have some coding help for this purpose. Is the code used by Nimbuzz available on the net for public use or some snippet of the code used by ...

Receiving complete message from TCP socket

Hi, I read data from a TCP socket connection, but the server sends me \0 from time to time (which would mark the end of a message). Thus, I do not get the rest of the message. I read like this: uint8_t buf[tcpBufferSize]; unsigned int len = 0; len = [inputStream read:buf maxLength:tcpBufferSize]; if(len > 0) { NSMutableData* dat...

UITableView weird crash on row deletion

I have an UITableView whose rows can be deleted. this table view has a search bar at the top. the problem is: if search was used, application crashes when I try to delete any row from the table view. there is no information in the debugger console. all I have is function stack from the debugger: Any ideas what it can be? UPDATE 1: cr...

How to read data from NSFileHandle line by line?

I have a text file having data as given e.g. PUFGUjVRallYZDNaazFtVjVObU1zWm5ZcUJUYU5ORk4zbGthNHNDVUdSMlFVQmpSVEoxUUNSallYaFhkanBITXBGR1NTQnpZRTltZE1OalVzSkdXQ0Z6WXR0V2RpTmpTdXgwTWs5V1lZSkZiWjFXT29OV2JSVlhaSTUwYUpwR040UUZXTzVHVXFoWFVRcFdWNHdVTUJ0Q1VHSmxXVlJVTlJCMVE1VTFWV PUFGUjVRallYZDNaazFtVjVObU1zWm5ZcUJUYU5ORk4zbGthNHNDVUdSMlFVQmpSV...

Long to nsdate in Objective C

I have an char array of 8 bytes which contains current date in long int. How can I convert this into NSDate. ...

Where is [NSIndexPath row] documented?

Can anyone point me to where [indexPath row] is described in the documentation, I have looked at NSIndexPath but I can't find any mention of "row"? I am assuming its an NSUInteger, but I would also like to double check its type and see what other properties are available. Example: - (void)tableView:(UITableView *)tableView didSelectRo...

Accessing property inside non-init methods gives bad access...

Hello, I've begun work on a side project, so the codebase is very small, very little that could go wrong. Something strange is happening. In viewDidLoad I initialise an array set as a property: @property (nonatomic, retain) NSMutableArray * story_array; And fill it with data. This printout is fine: NSLog(@"%@", ((ArticlePreview *)[s...