objective-c

custom NSView drawing not working

I'm trying to write a custom NSView that supports adding a background colour. I override drawRect - (void)drawRect:(NSRect)rect { [[NSColor blackColor] set]; //[NSBezierPath fillRect:rect]; //I tried this too NSRectFill([self bounds]); } And I set my custom view type to replace the content view NSView of my main wi...

stop a sound and later play it continuing from the stop position and not from the beginning of the sound

hi, that's the code play sound [soundSh play]; later stop sound (not pause!) [soundShe stop]; later play sound again [soundSh play]; fixed, i call sound int again ... ...

problem - when playing a sound the animation freeze\slowing

when playing a sound the animation freeze\slowing problem. sound size 20kb mp3. animation size 5kb png. also happens in other animation functions. basically whenever i play a sound the animation slowing down or pauses, what to do ??? code: - (void) startAnimation { [UIView beginAnimations:nil context:nil]; [UIView setAnimatio...

Variables/parameters in Sqlite query for Iphone App

Hi, In my Iphone App I have created this query: "SELECT * FROM visuel where id_visuel = 1" And so I have this function that works very well: - (void)getVisuel { visuelArray = [[NSMutableArray alloc] init]; sqlite3 *database; if(sqlite3_open([self.databasePath UTF8String], while(sqlite3_step(getVisuelParcSt...

Is app startup time restriction limited to applicationDidFinishLaunching?

If my app shuts down because load time takes to long, can I move some code in or being called from applicationDidFinishLaunching into the RootViewController? Meaning, is the (shutdown) timer only looking at applicationDidFinishLaunching? ...

NSTextField in NSMenuItem

Hi am writing small app for posting twitts on twitter.com I manage to create statusbar icon next to clock and battery monitor, but now I am stacked... I wanted to add menu item text area max length of 140 chars, (4-5 rows text input field) something like spotlight but multi-rows (BTW I have got working class, to put and get twitts on t...

NSDatePicker - getting the value when it is changed

How would I get notified of a value of a NSDatePicker, when it's changed? ...

read single line from text file in objective-C

hello, i'm new to iPhone programming and coding in XCode SDK.I want to access and read the configuration file which i have placed in Resource folder in XCode,my configuration file looks like this @key=value$ @vinu=flower$ @cathy=fruit$ I want to compare the key and access the value from configuration file. Since i'm working with iPho...

Objective-C: NSStatusBar right and left click

how to detect left or right click on statusbar icon, and than make some action, depending on which mouse button (trackpad) was clicked? I use: _statusItem = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] retain]; [_statusItem setMenu:menu]; [_statusItem setHighlightMode:YES]; To generate statusBa...

Obj-C server with multiple clients

Hi, I'm a fairly novice obj-c developer and have a question on how to set up a client-server relationship. I'm designing (mostly as a hobby) a board game to be played over the internet with friends and family (think monopoly). My problem: how do I set up the appropriate client-server relationship to have one server with multiple clien...

How do I measure the velocity of a swipe?

I'm developing a game that will use the force of the swipe as a variable user input. I read from the documentation that on the touchesEnded event, I can get the allTouches array which is a list of the user touches collected from touchesBegan. From this I plan to get the last two touches to get the direction of the swipe. I will also get...

Communication between view controllers

Given the section of an application which has a UINavigationController and 2 levels of UITableViews (i.e. a row is selected on the root controller which pushes the second controller onto the navigation stack) I have the following questions: 1) There is a User object which is required by both controllers. What is the best way to communic...

Create empty file for writing?

I am looking to create an empty file so I can open it for writing using NSFileHandle, is this the correct way or am I missing some better method? success = [fileManager createFileAtPath:dataFile_OUT contents:nil attributes:nil]; outFile = [NSFileHandle fileHandleForWritingAtPath:dataFile_OUT]; gary ...

Landscape UIView in a UITabBarController

Hi, I have a UITabbarController with (so far) two navigation controller items. I can get the application to rotate by adding the shouldAutorotateToInterfaceOrientation to each class... but thats not exactly what I want. What I want to do is to add a button in the UINavigationBar in one of the classes. When this button is pressed I want...

help! when playing a sound the animation freeze\pauses

basically whenever i play a sound the animation slowing down or pauses, what to do ??? sound size 20kb mp3. animation size 5kb png. code: - (void) startAnimation { [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.8]; CGPoint destination = CGPointMake(152,20); pink.center = destination; [UIView commitAni...

Objective-c with sql-lite on iPhone

Hello guys! Can you give me a good start for this? Thanks! ...

Reading ints from NSData?

I think I am getting a little confused here, what I have is a plain text file with the numbers "5 10 2350" in it. As you can see below I am trying to read the first value using readDataOfLength, I think maybe where I am getting muddled is that I should be reading as chars, but then 10 is 2 chars and 2350 is 4. Can anyone point m in the r...

The right place to do things in Objective-C

I started toying around with the ObjectiveFlickr framework with the goal of creating a relatively simple iPhone map application showing geotagged flickr content within the current MKMapView region. I ran into threading related trouble before and now I have the feeling I am getting something fundamentally wrong in my architecture. Basical...

how to stop sound, control volume... with AudioToolbox

hi, How i do the following using the AudioToolbox framework instead of the AVFoundation playing stop setCurrentTime volume i implement the SoundEffect class from the BubbleLevel example code and this options don't work. Thanks! ...

Residual/trace in Core Animation & CALayers

I am making an Cocoa app, using Core Animation to create custom UI. However, whenever I drag some layers around, they often leave some "residuals/traces" onto the other layers. So far, my guess is that it is related to my usage of [setNeedsDisplay]. To my understanding, as I drag a layer around, I don't need to call this method to that ...