In my current implementation of a UISearchBarController I'm using [NSString compare:] inside the filterContentForSearchText:scope: delegate method to return relevant objects based on their name property to the results UITableView as you start typing.
So far this works great in English and Korean, but what I'd like to be able to do is se...
I'm working on a Cocoa programming exercise, and I need to be able to determine which of two NSTextView objects is currently being edited. I think it's something to do with finding the first responder and checking to see if it's equal to one text field or another, but I can't quite get it to work. Any help would be appreciated.
...
Hi there.
At two stages of my app's runtime, I am sending an NSString to the following method.
I receive no warnings or errors in the code editor or the debugger, but when I NSLog the output (secondString), I only get given the memory address of the object.
Is there something I am not doing right here?
- (NSString*)validateString
{
...
Hello guys!
As the title says I want to ask about the fundamental data types in objective-c on iPhone.
So are there any good documentation where this is written?
I need the size on which the variable is represented and the range of the variable.
So in example:
short int - 2 bytes - signed: -32768 to 32767 and unsigned: 0 to 65535
This i...
How can I alert a user that they need to do something without using a push notification? For instance, if I have an alarm clock app, how can I get it to ring when it is not already running without using a push notification?
...
OK, I'm a little confused.
It's probably just a triviality.
I've got a function which looks something like this:
- (void)getNumbersForNews:(BOOL)news andMails:(BOOL)mails {
NSMutableDictionary *parameters = [[NSMutableDictionary alloc] init];
[parameters setValue:news forKey:@"getNews"];
[parameters setValue:mails forKey:@"getMails"]...
Considering that there is no NSTime in Cocoa-Touch (Objective-C on iPhone), and given two times as NSStrings and a timezone as an NSString, how can you calculate whether or not the current LOCAL time is between these two times. Keep in mind that the date in the time strings do NOT matter, and are filled with dummy dates.
For example:
...
HI,
Apple not providing touch events for UI-text View, im developing project includes notes, that can readable ,editable, can give color to selected text. for that i chosen UI-text View because it can readable as well as editable. to do some events on text of UI-text view need touch events ,but Apple not providing touch events for UI-te...
I've been coding on C++/Linux for 10+ years.
I am switching to do Mac development.
My development involves GUI components.
Is my only choice to learn Cocoa/Objective-C, or is there a way to wrap Cocoa and use it from C++ land?
Thanks!
...
I've a window with a table. The table lists several model objects by name. Those model objects back a window and that window's components all depend on the model objects for their values.
Some tables on that window cannot be bound to the model object and must be populated using a data source. In this situation I retrieve the currently s...
In the current book I am reading, the author implements an IBAction for a slider in the following way (see below V001). To my eye, it seemed a little over complicated so I re-factored the code (V002). Am I right in thinking that sender is a pointer to the object that fired the event? Also, is there any downside to casting sender in the h...
Can I create an ABAddressBook which does not read data from my address book. i.e. it's empty to start with so that I can put in my own contacts fetched from the internet.
As you may know the function
ABAddressBookRef ab = ABAddressBookCreate();
gives me data from the built in addressbook. This is not what I want but if you know a so...
<item>
<data>
<![CDATA[
<p>Test</p>
<p><strong>Hi!</strong><br />Hello.</p>
]]>
</data>
</item>
Using TouchXML/NSXMLParser How can i extract only the HTML part into a string/appropriate data format so that I can display it in a UIWebView?
It's definitely possible: http://code.google.com/p/touchcode/issues/detail?id=36&can=...
I'm curious, what role does the int main function play in a Cocoa program? Virtually all of the sample code I've been looking at has only the following code in main.m:
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[])
{
return NSApplicationMain(argc, (const char **) argv);
}
What exactly is this doing, and where does t...
There is a built-in shortcut NSApp, is there any reason that I shouldn't add one for NSFileManager?
#define NSFM [NSFileManager defaultManager]
I think omitted this will make my code cleaner and I can't see any benefit to keeping it in. (I plan on doing this in all my projects from now on, so it won't be obscure.)
NSFileManager *fm =...
I am writing an iPhone app that when a certain thing occurs, a sound is played. I have trying using different WAV, MP3, M4A files and have intermittent problems. The below code works fine in the simulator but the MP3 does not play on the iPhone. (3GS if it matters). Any ideas? I have changed the mp3 file to a wav and it will work fo...
In the code below, do I need to cast sender to UISlider? I can't really see the reason as sender is a UISlider object anyways?
-(IBAction)sliderChangeGoat:(id)sender {
UISlider *slider = sender; // OR UISlider *slider = (UISlider*)sender;
NSString *newText = [[NSString alloc] initWithFormat:@"%d", (int)[slider value]];
[slid...
In php i can call base64_encode("\x00". $username. "\x00". $password) and the "\x00" represents a NULL character.
I have a function that converts NSData to base64 encoded NSString created by DaveDribin.
How do I create data from a string that has null characters?
This doesnt seem to work...
NSData * authCode = [[NSString stringWithFo...
Hello im trying to get the latitude and longitude values where the the location of the user is
without having the map show up so basically it will run on the background. I guess i have to use the map kit but are there any examples?
...
[actionMap setObject:@selector(actionNavPop) forKey:@"navPop"];
This doesn't work. NSDictionary can only hold objects, and a SEL type is not an object.
For number types you can do [NSNumber numberWithInt:123] but is there any sort of similar object wrapper for selectors?
...