objective-c

how to check if array is null or empty?

Hi all, i want to check if my array is empty or null, and on base of which i want to create a condition for example. if(array == EMPTY){ //do something } i hope i'm clear what i am asking, just need to check if my array is empty? regards ...

How can I set a proxy object for a class loaded from a nib?

I have a NSViewController instance loaded by another nib. I think that initWithCoder:(NSCoder *)aDecoder, is called by the father nib. I want to set a proxy object in this new object. How can I do that? ...

TTTableImageItem : scrolling resizes image

Hi, I'm filling a TTTableViewController (via its "datasource" property) with items of class TTTableImageItem. The images are thumbnails downloaded from Youtube, and their original size is 120x90. In my TTTableView, they are automatically reduced so that they fill in their cells. But when I scroll up or down the view, they get back to t...

Dealing with editable items in a filtered UITable with an NSMutableArray copy

I have a UITable with a datasource that is set to a 'copy' of the original data. I use this copy to displayed filtered results (either 'All' or only those that are 'checked' with a UISwitch in each row). My logic for doing the filtering is here: -(void)filterItems { [tableData removeAllObjects]; if (checkedOrNotSwitch.selectedSegmentInd...

-[NSCFString objectAtIndex:]: unrecognized selector

I have this little problem I couldn't find in Google: UITableView works fine until I start scrolling. Error Message: `-[NSCFString objectAtIndex:]: unrecognized selector sent to instance 0x5f24870 ` Method: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString...

UIScrollView + UIToolbar problem

Hi guys, I got a small problem with my UIScrollView. I've added the scrollview to my UIView with Interface Builder. I've also added a UIToolbar as a subView (programmatically if it matters) to the view. Now, my problem is that the scrollview scrolls under the UIToolbar. It doesn't "stop" at the top of the toolbar as it should to. It w...

How do I process iPhone camera data and overlay a 3-D object on it?

I am trying to develop an Augmented Reality iPhone application in which I will place a 3D object in front of a live camera feed. I need to zoom in and zoom out the object as the user moves backward/forward, and rotate the 3D model as the user walks around. Is there a way to do this on the iPhone ? ...

Is this a memory leak?

Hi all, I have the following 2 code snippets. Assume I have a Parent class and in Parent.h class I have @property (retain) NSMutableArray *childrens; and I have synthesize it in the .m file correctly. assume in Parent.m file -(void) dealloc { [childrens release]; [super dealloc]; } In another class I declare like this. 1. P...

How to convert a NSString with Umlaut to Char / Glyph

Hi, I am trying to write heaps of text to the screen using a custom font. It all works well but I am having a bit of trouble getting it to work with strings containing a Umlaut. I tried all sorts of encodings with no success. This is what I did... I think it goes wrong when getting the C-Version of a string. the cars-array doesnt contain...

How to call a method when tap on MKOverlayView

Hi all, I am implementing a MKMapkit based application, in that I need to call a method when we tap on a overlay?. Can you guys please help me on this. Thank you, S ...

Drag an UIImageView from UIscrollView to another view

Hello, i crawled all the web, but nothing. I have a for loop to create uiimageview inside a uiscrollview controller. It's a collection of images that you can scroll horizontally only. for (int i = 0; i < NIMAGES; i++) { NSString *filename = [NSString stringWithFormat:@"image%d.png", i+1]; ScrollerImage *iv = [[ScrollerImage all...

Where should i be using removeFromSuperview in relation to adding views to a table?

Hi guys, I have a little table that works pretty well. But I was told to remove my subviews at some stage incase the call to drawn the table happens again for whatever reason. I was told it can be handled using removeFromSuperview. Where and how should i handle this? I need to use tags to identify the cells or views? Here is my code t...

Load image asynchronously from file

I have an relatively image in local storage, I want to show it to the user without disturbing UI thread. I'm currently using [[UIImage alloc] initWithContentsOfFile:path]; to load image. Any suggestions/help please.... ...

Is the a way to turn off the UITableView delegates temporarily?

I have a UITableView with the usual table view delegates. The problem is that the table is built from core data .. so when my refresh method runs it refills the core data entities. I think this means that the data for the table is unstable, and hence it crashes on a line like this (in 'cellForRowAtIndexPath'): cell.textLabel.text = [obj...

UIButton modify image of UIImageView

Hi guys, I'm developing an iPhone app, and I need a little help. I created a button and I want when I click on to change an image's imageView by the button's one. the image and button : CGRect slot1Rect = CGRectMake(70, 90, 80, 110); UIImageView *slot1 = [[UIImageView alloc] initWithFrame:slot1Rect]; [slot1 setImage:[UIImage im...

Objective-c: Dynamic Class Names

I'm not sure if I worded the subject correctly. I am looping through an array, within each loop I am trying to instantiate a class, but I want to dynamically create the name. Like so: int i = 0; for(NSString* thisdatarow in filedata) { i++; NSString* thisad = [NSString stringWithFormat:@"ad%d", i]; NSLog(@"%@", thisad); ...

Parse HTML that is stored in a NSString

I am parsing a group of post on a blog. I have some HTML that I successfully assigned to a string. I am trying to get the HTML to display in a UITableview. However, I want it formatted. For instance I want <br /> to actually do a line break in the table and <img scr= to actually display the picture. How can I accomplish this. ...

How can I force entry to complete in a NSTextField from a NSButton

I just noticed a problem when my user-interface is in a certain state. I have a table view with two columns both of which the user can enter data that is to be used later. There's also a button which acts upon the contents of the table view. The problem is if the user has entered new data in the column but has not yet exited the field ...

Auto play youtube ipad

hi, im trying to autoplay embed video within ipad. i have this code but it dosent seem to be working: - (void)loadWebUIViewWithYoutubeLink { webView.delegate = self; NSString *htmlString = [NSString stringWithFormat:[NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResour...

Storing a struct in an NSArray

Hello! Back with my daily silly question. Today I'm trying to put a struct in an NSArray. Alright, that's easy, wrap it in a NSData. If you know me, you know you're about to see code. In this example, I'm loading a vertex line from a Wavefront OBJ into a struct and sticking it in an array. NSArray *verticeLineParts = [currentLin...