objective-c

How to save web page locally in iPhone?

Hi all, I want to see previously viewed web page in iPhone when I will offline (not connected to internet). Currently I am just opening the web page from my application by using NSURL. But when user is offline he is not able to see the web page. I have a requirement that user must be able to see the previously viewed web page from my...

Accessing objects in NSMutableDictionary by index

To display key/values from an NSMutableDictionary sequentially (in a tableview), I need to access them by index. If access by index could give the key at that index, I could than get the value. Is there a way to do that or a different technique? ...

How to make a blinking (or flashing) cursor on iphone?

I'm trying to create a custom "blinking cursor" in UIKit, I've tried as shown below, having 2 functions that basically keep calling each other until the cursor is hidden. But this leads to a nice infinite recursion... for some reason the functions call each other right away, not each half-second as expected. I tried returning if the 'fi...

conversion to doubleValue doesn't work .. but to integerValue does

Hello all I'm trying to convert a string to a double and it doesn't work. However if I convert it to an integer it does work this is my code snippet int myDuration = [myDurationString integerValue]; int conversionMinute = myDuration / 60; if( myDuration < 60 ) { [appDelegate.rep1 addObject:[NSString stringWithFormat:@"%d",m...

Storing Custom Classes in Objective-C

I need to take existing classes for an iPhone application and store them in a preference/plist/some other data storage format. A good comparison of what I need to store is a gradebook, with the following class structure: GBGradebook + NSArray (GBAssignment) + NSArray (GBClasses) + NSArray (GBStudent) GBStudent + NSString *stude...

UISearchBar Bookmarks

Does anyone have a good sample of storing bookmarks for a UISearchBar? What's the most elegant way to store this? Any sample code would be appreciated. ...

Receiving keyDown and keyUp events in a Cocoa Status Bar app

If you create a status bar app with no windows, how do you respond to events? My first guess was creating an subclass of NSResponder and override the appropriate methods. However they never get called. This lead explicitly calling: [self becomeFirstResponder]; Which also didn't work (and I don't believe is recommended by the Apple D...

iPhone - convert mp3 to wav?

Hi Is there a way I can convert an mp3 file into a wav/aiff in my iPhone app? I have an mp3 but I want to combine it with other files and the only way I know this can be done is when using PCM formats. Can anyone help me out here? Thanks. Some things I tried I tried using the AudioConverterFillComplexBuffer() method and its callback...

Is it possible to have a sound play before/during the splash screen?

My app takes a few seconds to load and I have a splash screen. Once "viewDidLoad" I have a little sound play. I feel that the sound would be in better use if it started playing when the splash screen popped up. Is it possible to have a sound start before/during the splash screen? Here is my code: (under viewDidLoad) NSString *sound...

Adding to a core data model from an NSArray.

I have an NSArray of strings and I want to add a certain amount of rows to the outline view depending on how many strings are in the array, each with the title of the String that was added. I think it would involve looping through the array like this. for(NSString *title in array) { JGManagedObject *theParent = [NSEntityD...

How to send ussd request through programming on iPhone OS

How to send ussd request through programming on iPhone OS For example: *100# ...

XCode xcconfig: Configuring a dependency based on the target

In the quest to resolve the Objective-C namespace issue I'd like to experiment with prefixing a dependency's Objective-C classes based on the target being built. As an example, suppose I have in my shared library (ObjCStaticLib) a class (CWindow). I have two plugins (A and B) that will use this CWindow. To avoid A's CWindow from collidi...

Recursive method in objective-c problem with NSMutableArray

I'm trying to create a recursive method that moves throw a NSMutableArray, something is happening that the code stays inside the loop or makes it only once. Here is my code: - (NSMutableArray* )solve:(NSMutableArray* )temp{ //just a counter int count =0; int index =0; if (count==0) { //Calculates the diffe...

How to base class behaviors on typedef enums, the way Apple does in Objective-C?

Kind of a weird newbie question...I want to use typedef enum declarations in one of my classes . This particular class gets used by other classes, where a client class might say something like "set your style to Style1 (enumerated type)". Then the target class's behavior would change accordingly. This is analogous to the way that UITa...

Copy text to clipboard with iPhone SDK

Hi What is the best way to copy text to the iphone's clipboard in your application, their docs are sketchy and have way too many features than what i want... i just want to set a string as the users clipboard? Sample code would be so useful! ...

-viewDidLoad not called in subclassed UIViewController

Have patience with me, I'm still learning Cocoa Touch. Other -viewDidLoad not being called question was unrelated to my issue, I did search. I have FooViewController, a UIViewController subclass. FooViewController.xib has its File's Owner set to FooViewController. Additionally, I have Main, whose App Delegate is MyApplication and whose...

compile basic mysql c code with xcode

Anyone manage to write code that uses the mysqlclient library? I can get compiling working but not linking :( XCode produces the following output: Build TestMysql of project TestMysql with configuration Debug Ld build/Debug/TestMysql normal x86_64 cd /Users/jacob/Documents/cocoa/TestMysql setenv MACOSX_DEPLOYMENT_TARGET 10.5 /Develope...

objective-c logging best practices

I am writing my first objective-c daemon type process that works in the background. Everything it does needs to be logged properly. I am fairly new to Apple stuff so I am not sure, what is the most common and/or best way to log activity? Does everyone simply log to a text file in their own special format, or use some sort of system call...

How to use facebook-connect invite friends iphone app ?

My app needs to invite friends from facebook conenct is this possibl e? Any examples ? Please help ! ...

Switch Button not working in Cocoa-Touch

I am new to Objective-C and Cocoa-Touch development. I have an ON/OFF Switch on a view that is supposed to disable/enable hide/show another button on the same view, but for some reason it doesn't work sometimes, this is the behavior: 1st click: Switch to OFF, Other Button hidden => OK 2nd click: Switch to ON, Nothing happens => WRONG 3...