I am just learning Objective-C / Cocoa and I am a little unsure how I might extend my code to display the size of the files found.
EDIT 2
I have taken the comments from SMorgan & Peter below and worked them into the code ... comments most welcome.
// ------------------------------------------------------------------- **
// DISC: FILE...
I will soon be working on an application which needs to get the currently selected text in the frontmost application window, be it Safari, Pages, TextEdit, Word, etc., and do something with that text.
My goal is to find a solution that works with as much applications as possible. So far I thought about using AppleScript, but that would ...
I have a question concerning the caching of webcontent.
I've created a UIWebview component
Code:
NSString *urlAddress = @"http://192.168.55.101/~test/mobile/iphone/ads/v0.1/";
//URL OBJECT footer
UIWebView *aWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320 , 100)];
NSURL *url = [NSURL URLWithString:urlAddress];
...
I' have a lot of png's with different sizes, and i want to load them into a table. I have this code:
charImage.image = [self imageForId:g.charId glyphNr:g.glyphNr];
[charImage sizeToFit];
//charImage.contentMode = UIViewContentModeCenter;
charImage.center = CGPointMake(30, 23);
Everything works fine except that my pngs are blurry. If ...
i have a view with uimageview and an image set to it. i want to erase image as something like we do in photoshop with an eraser.how do i achieve this.also how do i undo erase???
...
I would like to save an NSArray either as a file or possibly use user defaults. Here's what I am hoping to do.
Retrieve already saved NSArray (if any).
Do something with it.
Erase saved data (if any).
Save the NSArray.
Is this possible, and if so how should I do this?
...
My understanding is that both of these create a NSMutableString, only the first one is owned by the system and the second one is owned by me (i.e. I need to release it). Is there any particular reason why I should use one or the other, on the face of it it seems easier to use the first? Also is the first better as it gives the compiler a...
So I am creating my first opengl es application on the iphone. I want to autorelease an object and that was around the time I noticed that I can't seem to find the location of the autorelease pool.
1) Is the autorelease pool already created for me in an iphone opengl es application?
2) If it is already created for me how often is the ...
I basically want to automatically create a tiled image from a bunch of source images, and then save that to the user's photo album. I'm not having any success drawing a bunch of small UIImage's into one big UIImage. What's the best way to accomplish this? Currently I'm using UIGraphicsBeginImageContext() and [UIImage drawAtPoint], etc. A...
What's the best way to design/use my model and NSFetchedResultsController so that I can use a table with variable height cells? Computing the height is expensive (and requires access to the model's data) so I'm caching the value in my model. However, I know that the tableview will ask for heights of all visible cells.
My current thoug...
I a profiling my iPhone application on target, and according to Instruments 65% of the time is spent in mach_msg_trap.
I have a background thread that runs-forever and send results back to the main thread using performSelectorOnMainThread:withObject:waitUntilDone:, aproximately every 2 seconds. I am not waiting until done.
// Fredrik
...
I'm trying to zip up my iPhone application for App Store distribution.
The distribution instructions suggest looking in the build log to check if the mobileprovision file was included, but I can't figure out how to show a build log.
Apple's instructions:
To confirm your build was successful, check for the following:
O...
Just curious if this is the way to do this, just want to make sure its not leaking, although I would think I am only modifying the string contents.
NSMutableString *newPath = [[NSMutableString alloc] init];
for(fileName in [manager enumeratorAtPath:rootPath]){
if ([[fileName pathExtension] isEqual:@"exr"]) {
[fileArray addO...
Hello,
How do I calculate the number of months between two dates using Cocoa?
Thanks,
Stan
...
Hey Everyone,
I have this code:
NSWorkspace *sharedWorkspace = [NSWorkspace sharedWorkspace];
NSString *appPath = [sharedWorkspace fullPathForApplication:appName];
NSString *identifier = [[NSBundle bundleWithPath:appPath] bundleIdentifier];
NSArray *selectedApps =
[NSRunningApplication runningApplicationsWithBundleIdentifier:identi...
EDIT_v002
I have had a look at all the comments and I am starting to see what I should be doing. To that end I have modified my code (see below) I have changed newPath to a NSString, removed the [[alloc] init] and the end [release] as its now handled by the system. I am using stringByAppendingPathComponent, letting it add a separator be...
Using OS 3.1 I'm placing a tap-detecting image view (taken from Apple's Scroll View suite samples) in a UIScrollView and want to zoom twice on the image view when it appears. The first zoom is to make the entire image visible and the second zoom is to zoom in to a specified region. What I have right now is:
- (void)viewDidLoad {
// ...
Hello all,
I have a simple question, that in a class I have a variable with property retain
//Classs ArrayClass has this array
@property(nonatomic, retain) NSMutableArray *array;
Now when I do
self.array = [SomeClass getArray];
I need to release the array...
Now If I have object of ArrayClass and when I do
arrayClassObj.array = ...
Is there a way to dynamically call an Objective C function from Python?
For example, On the mac I would like to call this Objective C function
[NSSpeechSynthesizer availableVoices]
without having to precompile any special Python wrapper module.
...
This crashes (but without outputting any info to the Debugger; no dump, no trace):
adMobAd = [AdMobView requestAdWithDelegate:self]; // start a new ad request
[adMobAd retain]; // this will be released when it loads (or fails to load)
I thought it was because my code isn't executing in NSDefaultRunLoopMode, which AdMob says is require...