objective-c

UIWebview isn't displaying content I want it to display

In my app I have a UIWebView which loads different rtf files. I use this function to load these files: - (void)loadFile:(NSString*)file { NSString* resourcePath = [[NSBundle mainBundle] resourcePath]; NSString* sourceFilePath = [resourcePath stringByAppendingPathComponent:file]; NSURL* url = [NSURL fileURLWithPath:sourceFilePath isDirec...

Best solution for styled text within a uitableviewcell?

Fo styled text (bold, italic, diff fonts and sizes), what's the best solution for putting a chunk of text within a cell? The text can of various lengths, so the cell would have to change it's height accordingly. ...

how to display video in landscape mode at the start of the application means after launching

how to display video in landscape mode at the start of the application means after launching ...

UIImagePickerController with my images

Hi all! I'm developing an app and I wish use the UIImagePickerController but I wish let the user to choose some images saved into my app, not the photolibrary.. it's possible to do this?? thanks in advance!! ...

Deleting a line from a txt file in objective-c

Is there a way to remove a line from the end of a .txt file from Objective-C? I can't seem to find anything on manipulating text files from Objective-C, only reading them into a NSString. ...

Implementations details of drag and drop of file path in cocoa.

Hi, I'm trying to get a part of my window to react to drag and drop. In this case to copy the file path to the file being dropped on the view. I have looked over some documentation but I still have some problems to see exactly where I should implement my methods for drag and drop. I have seen some examples but almost all of them assu...

Conceptual question about NSAutoreleasePools

In my Cocoa program, wouldn't a really simple way of dealing with autoreleased objects be to just create a timer object inside the app delegate that calls the following method e.g. every 10 seconds: if (pool) { // Release & drain the current pool to free the memory. [pool release]; } // Create a new pool. pool = [[NSAutorelease...

Problem while adding new Object to CoreData App

Hi Another Day, another CoreData problem,...but hopefully the last one now. Ok here is a copy of what I have : I have a List of Hotel Guests that stay in one Room and have Preferences. Once ready the user should select a guest and see the data and should also be able to add new guest, select the room (maintained also by application) a...

Dealloc on my custom objective-C

Hello. I'm developing an iPhone application, and I very new on iPhone development. I've created some custom classes with instance variables (NSArray, NSString, etc.). All classes inherits from NSObject. Should I create a dealloc method to release all instance variables? Thank you. ...

initWithCoder works, but init seems to be overwriting my objects properties?

Hi guys, I've been trying to teach myself how to use the Archiving/Unarchiving methods of NSCoder, but I'm stumped. I have a Singleton class that I have defined with 8 NSInteger properties. I am trying to save this object to disk and then load from disk as needed. I've got the save part down and I have the load part down as well (acco...

Can't draw UImage in UIView::drawRect

I know this seems like a simple task, which is why I don't understand why I can't get the image to render. When I set up my UIView, I do the following: myUiView.backgroundColor = [UIColor clearColor]; myUiView.opaque = NO; I create and retain the UIImage in the init function of my UIView: image = [[UIImage imageWithContentsOfFile:[[...

How does autosize work in iPhone SDK?

Hi, I'm trying to do the following: I need to do a lot of custom things, so I subclassed everything. I'm having issues with autoresize and positioning. For instance the UIToolBar is not at the correct position. So here is the question: If you don't use UITableViewController or any other Controller, that takes care of all the posi...

Flipping OpenGL texture

When I load textures from images normally, they are upside down because of OpenGL's coordinate system. What would be the best way to flip them? glScalef(1.0f, -1.0f, 1.0f); mapping the y coordinates of the textures in reverse vertically flipping the image files manually (in Photoshop) flipping them programatically after loading them (I...

Why does this program take up so much memory?

I am learning Objective-C. I am trying to release all of the memory that I use. So, I wrote a program to test if I am doing it right: #import <Foundation/Foundation.h> #define DEFAULT_NAME @"Unknown" @interface Person : NSObject { NSString *name; } @property (copy) NSString * name; @end @implementation Person @synthesize name; - (v...

CATransaction: Layer Changes But Does Not Animate

I'm trying to animate part of UI in an iPad app when the user taps a button. I have this code in my action method. It works in the sense that the UI changes how I expect but it does not animate the changes. It simply immediately changes. I must be missing something: - (IBAction)someAction:(id)sender { UIViewController *aViewControll...

Objective-C NSString Assignment Problem

In my Cocoa application, in the header file, I declare a NSString ivar: NSString *gSdkPath; Then, in awakeFromNib, I assign it to a value: gSdkPath = @"hello"; Later, it's value is changed in the code: gSdkPath = [NSString stringWithString:[folderNames objectAtIndex:0]]; (the object returned from objectAtIndex is an NSString) Howe...

Read/Write on Plist file without using the iPhone SImulator?

Hello all, i am using an example from the iphone developer book from apress. the problem is that this example only works on the simulator im trying to figure out how i can make it work on the device. This chapter isn't working at all. below is the sample code. data.plist is located in the resource folder. NSArray *paths = NSSearc...

iPhone SDK: How to add multiple labels to table cell?

I am trying to create a custom table cell that has multiple labels. I already have code to create a custom cell. My problem is, it is just not that pretty. What I need is some pointers on how to apply multiple labels each of which may be a different color, font, etc. These are the labels I would like to include and they should appear ce...

strange run time error message from CIImage initWithContentsOfURL

When executing the following code I receive a run time error when the code executes the second line of code. The error (which shows up in the debugger) says: [NSButton initWithContentsOfURL:]: unrecognized selector sent to instance 0x100418e10. I don't understand this message, because it looks to me (based on my source code) like the ...

How much of the "Objective-C" I'm learning is universal Objective-C, and not Apple's frameworks?

This question is related to one of my others about C: What can you do in C without “std” includes? Are they part of “C,” or just libraries? I've become curious lately as to what is really contained the the core Objective-C language, and what parts of the Objective-C I've done for iPhone/OS X development is specific to Apple platforms. ...