objective-c

How to wrap a C++ lib in objective-C ?

I have a C++ library (.h only) that contains the implementation of a data structure and I'd like to use it in my iPhone app. Firstly, I wrote a wrapper in objective-C++ as a class that, through composition, has an ivar of the C++ class. I then was 'obliged' to change the wrapper class extension to .mm, and it seemed fine. But then I ha...

split string from string

I have a string that contains <name>James Jones</endofname> how would i get the name from the centre pragmatically. Thanks James ...

Swapping objects. Cant get my head around it.

Ok if I have 3 objects. ObjectType *objX; ObjectType *objY; ObjectType *tempObjHolder; objX = [[alloc ObjectType] init]; objY = [[alloc ObjectType] init]; // some code to change values in the objX and objY tempObjHolder = objX; objX = objY; objY = tempObjHolder; Am i swapping the objects ok. Or am I confused to how this works. Do i...

Problems when passing self to a function in Objective-C

While writing an iPad application, I seem to be running into a lot of weird errors. Basically, I have a parent class "Ticker" that checks to see if stock ticker data is cached and if it isn't, it creates an instance of NetworkTickerData, passing itself as an argument and adding the returned data to itself. Here is the code for [Ticker g...

memory leak in uimapkit polyline

Hi, I'm practicing drawing polyline on the Map. I've adopted Sample code from download here. Here is the part that I got memory warning when I do build->Analysis MKMapRect routeRect = MKMapRectMake(southWestPoint.x, southWestPoint.y, northEastPoint.x - southWestPoint.x, northEastPoint.y - southWestPoint.y); // clear the memory allocat...

How to model core-data relationship, one-to-one or one-to-many?

I have Customer object and Loan object. It is a one-to-many relationship (Customer <-->> Loan). Each loan has exactly 5 type of Payoff plans (exactly 5 and will not change for the next 100 years) for customer to select and to see the payment projection. Each Payoff plan consist of type, initial-payment, monthly-payment, interest, number-...

Hide mouse cursor on OS X after a few seconds

For my fullscreen app, I want to hide the cursor after a few seconds if it's not moved, like the fullscreen mode in QuickTime or iTunes. Presumably I'm looking to call [NSCursor setHiddenUntilMouseMoves:YES], but how do I know when to call it? Presumably I'm looking for the same as http://stackoverflow.com/questions/744980/hide-mouse-cu...

iOS communicating with OS X

I'm looking for a pointer in the right direction to get started with writing an iPhone app that sends commands to OS X, for example telling OS X to sleep. I can't seem to find the relevant part of the documentation? ...

Sending cell-values in cellForRowAtIndexPath at button-press.

Hey! I have stumbled upon a problem when adding a button to my table view cell. Let me explain after i have added the code: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; RadioCustomCell * cell = (RadioCustomCell*)[tableView dequeueRe...

Using iOS device as TCP client - no Bonjour

I'd like to use iOS device as a TCP client, but I can't find an understandable API/guide/sample of how to do that. I tried SimpleNetworkStreams and PictureSharing, but they are both using Bonjour. I can make UDP connections easily, learned via UDPEcho, but I can't find as good sample as UDPEcho for TCP. I want a simple example of connect...

iphone keyboard keydown/keyup events??

Hello Everyone, I am a newbie in iphone development, yet wondering why i am not able to find any help regarding the keyboard keyup/keydown events, I actually want to detect which key is been pressed by the user via keyboard on iphone while inputting the text in the UITextField. I need an urgent help!! ..... Thanks in advance Mehroz ...

Memory Leak according to Instruments

Hi guys, Been running instruments on my app. Its says i am leaking 864bytes & 624bytes from 2 NSCFString and the library responsible is Foundation. So that leads me to believe thats its not a leak caused by me? Or is it? Here is the offending method according to instruments. It seems to be a substringWithRange that is leaking. -(...

How to implement utility application with navigation based flipside?

I would like to create an utility application that has a navigation based flipside, or "info", view. What would the most efficient way to accomplish this be? I think that i 'simply' need to make a root view controller for the flipside view...but i really only understand that conceptually...not so much how to go about it or, at least, i...

CoreData: deleteObject faults on relationships when nil.

We have a project that has two one to many relationships. We encounter a core data fault when we try to delete the parent object. This ONLY happens if the child relationships are empty. So for example: A project has many to-dos and messages. If we create a project and add a message and a to-do to it, and subsequently call deleteObject o...

Two iPhone Apps with same code base

I want to create two iphone apps with very similar code base. The only differences will be some settings and the UI skin. Instead of creating two xcode project and copy the all the code over. Is there a better way to set this up? for better maintainability? 95% of the code are the same. ...

Objects and Classes

I come from a java background, I know how to call methods from objects but would the following be impossible? main(){ int v1=2; int v2=3: int sum; sum = [Add: (int) v1, (v2)]; } add ((int) v1, (int) v2)){ return v1+v2; } And my second question, How would I define a variable that is static throughout every insta...

Disable UIWebView default scrolling behavior using objective-c

I know you can use a javascript to do this <script type="text/javascript"> touchMove = function(event) { event.preventDefault(); } Is there a way to do the same using objective-c? ...

UIView ivar vs. tagging a local UIView var

Scenario 1: For a UIViewController, is it better to (1) create an ivar for a UIView that I access again in 1 or 2 functions outside of loadView? Or, (2) should I just tag it in loadView and then use - (UIView *)viewWithTag:(NSInteger)tag to access it again in the other functions? I'm guessing that option 1 increases the memory by the siz...

comparing 2 arrays ,remove the elements with same field

Hi all, Here is my problem, I have 5000 arrays, I want to remove the elements in array4999 those are with identical name to array5000, then add to array5000. Comes out a new array,say NewArray1. then remove identical name elements from array4998 and comes out NewArray2. Iteratively ,till all 5000 arrays are done with filter and leave...

Is it possible to retrieve the modified time of the iPhone contacts record?

Hi, everyone, I want to ask a question about iPhone. Is it possible to retrieve the modification time from the iPhone contacts of each record? Thank you. ...