iphone

[super init] and loading NIB / XIB files?

I am a little curious, I have a view controller class and an NIB/XIB (both are named "MapViewController") If I do the following it loads the NIB with the matching name. -(id)init { self = [super initWithNibName:@"MapViewController" bundle:nil]; if(self) { do things ... } return self; } if on the other hand I ju...

Three20 TTSectionedDataSource row height

Hey there, I'm using Three20 to create a table with several textfields for user registration. I've found two possible methods using Three20. The first uses the TTSectionedDataSource's tableDidLoadModel method to manually add UI components and the second adds custom items that contains pre formatted UI components. The second option se...

Create object from NSString of class name in Objective-C

I was wondering if i could create a object of some class if i have the name of the class in a NSString. I know this is possible in other languages like ActionScript, C# and PHP... Something like this: NSString *className = @"AwesomeViewController"; UIViewController *object = [[className alloc] initWithNibName:className bundle:nil]; ...

iPhone Objective C - error: pointer value used where a floating point value was expected

I do not understand why i am getting this error. Here is the related code: Photo.h #import <CoreData/CoreData.h> @class Person; @interface Photo : NSManagedObject { } @property (nonatomic, retain) NSData * imageData; @property (nonatomic, retain) NSNumber * Latitude; @property (nonatomic, retain) NSString * ImageName; @property (...

Why do .png backgrounds appear black on iPhone device but not simulator?

I started with a .tiff file and used GraphicConverter to change it to a .png and set a transparency color. Worked fine in the simulator but when I pushed to the device the transparency color became black. Tested with a .png I downloaded from the net and that worked fine, so it seems to only happen with some files. Thus I suspect it ha...

Touch draw in Quatz 2D/Core Graphics

Hello, I'm trying to implement "hand draw tool". At the moment algorythm looks like that (I don't insert any code because methods are quite big, will try to explain an idea): Drawing In touchesStarted: method I create NSMutableArray *pointsArray and add point into it. Call setNeedsDisplay: method. In touchesMoved: method I calculate ...

Problem adding UITableViewCell manually

I am trying to add a UITableViewCell at the very bottom of my UITableView programatically. I am getting an index out of bounds error, which I am not sure how to resolve: - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. return [items count]+1; ...

Is it possible to create a UINavigationController within a ModalPopup?

Hi I have a modalViewController that I am popping up using [self presentModalViewController:myController animated:YES]; I have an event occurring within myController which I would like to result in another controller being pushed onto the navigation stack ON TOP OF myController (which again has been presented modally). How can I ...

What's the difference between typedef const struct *CGPath and typedef struct *CGPath?

I've found this in the CGPath.h header file. I'm curious what this const thing does? typedef struct CGPath *CGMutablePathRef; typedef const struct CGPath *CGPathRef; My guess: If I typedef something as const, it's constant so immutable and can't be changed in any way. Does that make sense? ...

How to step inside NSManagedObject; access individual attributes.

NSManagedObject *entryObj = [self.fetchedResultsController objectAtIndexPath:indexPath]; entryObj consists of four String attributes. If I NSLog entryObj, I get the information I want. I cannot figure out how to access each of these properties individually. I read a similar post where the solution was to call ...

How does one create an elegant iPhone GUI?

This is just one of those things where you feel like your own design is utterly terrible, and that all of the other apps have a beautiful design. This question is just about how you would go about creating a user interface that a user would actually want to use? ...

Using iPhone Core Data to many Relationship

When I define a to many relationship between entities in Xcode and then generate the data class from the entity I get a header with the following methods defined: @interface PriceList (CoreDataGeneratedAccessors) - (void)addItemsObject:(PriceListItem *)value; - (void)removeItemsObject:(PriceListItem *)value; - (void)addItems:(NSSet *)va...

JSON and Iphone table loading, I'm getting a EXC_BAD_ACCESS error when scrolling

Hello, I'm having a bear of a time trying to figure out why I'm getting a EXC_BAD ACCESS error. The console is giving me this eror: " -[CFArray objectAtIndex:]: message sent to deallocated instance 0x3b14110", I Can't figure it out...Thanks in advance. // Customize the number of rows in the table view. - (NSInteger)tableView:(UITableVie...

How can I truncate an NSString to a set length?

I searched, but surprisingly couldn't find an answer. I have a long NSString that I want to shorten. I want the maximum length to be around 20 characters. I read somewhere that the best solution is to use substringWithRange. Is this the best way to truncate a string? NSRange stringRange = {0,20}; NSString *myString = @"This is a strin...

Problem trying to draw a plane in OpenGL-ES iPhone

Hello everyone. I would like to say that my OpenGL-ES experience is very limited and that I've been searching for an answer without success. I'm trying to draw a textured plane with the following code const GLfloat spriteVertices[] = { -1.0f, -1.5f, 1.0f, -1.5f, -1.0f, 1.5f, 1.0f, 1.5f, }; glVe...

<Error>: FT_Select_Charmap failed: error 6

I have a method where I draw a PDF to a bitmap. Once in a while I see this error in the log when running it on an actual device (not simulator): <Error>: FT_Select_Charmap failed: error 6 The error is occurring at the marked line (#11): NSURL *url = [NSURL fileURLWithPath:pdfFilePath]; CGPDFDocumentRef documentRef = CGPDFDocumentCrea...

UIImage from NSDocumentDirectory leaking memory

Hey. I currently have this code: UIImage *image = [[UIImage alloc] initWithContentsOfFile:[imagesPath stringByAppendingPathComponent:[NSString stringWithFormat:@"/%@.png", [postsArrayID objectAtIndex:indexPath.row]]]]; It's loading in an image to set in a UITableViewCell. This obviously leaks a lot of memory (I do release it, two lin...

Links in UINavigationController

What is the class type used to create items that look like HTML links in iPhone apps? Is it just a label with formatted text? How is the selection detected? I am looking to have a Navigation Controller and have some text links on the root page. The user can then select any of the links, and the controller will go to the page for that...

Preventing an <input> element from scrolling the screen on iPhone?

I have several <input type="number"> elements on my webpage. I'm using jQTouch, and I'm trying to stay fullscreen at all times; that is, horizontal scrolling is bad. Whenever I click an <input> element, the page scrolls right, showing a black border on the right of the screen and de-centering everything. The inputs are offset from the le...

How to compile x264 for iPhone

Hi, I'm trying to compile x264 for use in an iPhone application. I can compile with using http://github.com/gabriel/ffmpeg-iphone-build File: build-x264-armv6/7. but only decoding. I want to use encoding too. when I use build-x264-armv6/7,The console show me "mp4 output: no". Does anyone know how to compile x264 which is able to encodin...