objective-c

UITextField: move view when keyboard appears

Hello! I'm currently working on an iPhone application with a single view, which has multiple UITextFields for input. When the keyboard shows, it overlays the bottom textfields. So I added the corresponding textFieldDidBeginEditing: method, to move the view up, which works great: - (void)textFieldDidBeginEditing:(UITextField *)textField...

Cancelling operation with connection inside

I have a NSOperation that downloads some data using NSURLConnection, it looks somewhat like this: .... - (void)main { .... while (!self.isCancelled && !self.isLoaded) { [NSRunloop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NDate distantFutute]]; } .... } The problem is that from time to time connection han...

iPhone: MKMapView Strange crash

Hi everyone, I'm having an issue with a MKMapView, hope someone can help me. I have a view that embed a MKMapView and a navigationController. I push in my navigationController another viewController then another one again. Then if I go back to the MKMapView and touch the map, the application crash. so MkmapView > View2 > View3 > View2 ...

Properties of relations in Core Data

In order to better learn both Cocoa and Core Data, I decided to build an application that holds cooking recipes. However, while trying to create the CD model, I already got stuck. These are three of the classes, simplified: Recipe: name ingredients instructions Ingredient: name unit (liter, teaspoon etc) Of course, the ingredients ...

UIView getting disabled

I have a UIView that's starting about 600 pt's off the screen, but when it comes on to the actual frame, it seems to be disabled. I've tried using a UIScrollView, but also can't because I need to access the touchesBegan and touchesMoved methods form my UIView, so how would I enable interaction after it comes back on to the screen. And...

How to keep an object in view of a scrollview while animation moves the object offscreen

Good day all; I have an UIImageView that I animate around a large UIView. The UIView is contained within a UIScrollView. Now, with small movement animations of the UIImageView within the UIView, if it passes a certain thresh hold (gets close to the edge of the screen), I will manually scroll the UIScrollView to re-center the UIImageVie...

Sending message to Twitter creates an error message

Hi, I'm trying to get the following code to run (it's from the Heads First iPhone Development book - page 81), it's a twitter app, and the code blow runs when you press a button to send a simple text message to twitter: //TWITTER BLACK MAGIC NSMutableURLRequest *theRequest=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"...

iPhone multi view application design question

Hi! I have a question about iPhone app design approach... I have in mind to make some complex application and I think that the best base for my needs is "Tab Bar Application" template. Actually, I've been looking some apps on iPhone, and AppStore's design is definitely what I need; a Tab Bar based app with different options on the top - ...

Possible to get the hostname of an IP using SystemConfiguration?

I'm using the SystemConfiguration framework to get the current IP from the dynamic store in my app. Is it possible to get the hostname from the dynamic store as well? The current IP could be local, so I'm trying to get the returned value to be something like "mymac.local" or "2adg3.dsl.lgtpmi.sbcglobal.net", depending on how I'm connect...

Changing Backlight Level, iPhone

Hello all, I searched around for a way to set the backlight level within an app on the iPhone. I found a solution here: http://www.iphonedevsdk.com/forum/29097-post3.html The problem I have is, when I add this to my app I get an error and a warning. My code is as follows: #include "GraphicsServices.h" - (void) viewWillAppear:(BOOL)an...

Function Pointers in Objective C

Hey Everyone! Quick question. Does anyone know how to get the function pointer of an objective c method? I can declare a C++ method as a function pointer, but this is a callback method so that C++ method would need to be part of the class SO THAT IT CAN ACCESS THE INSTANCE FIELDS. I don't know how to make a C++ method part of an objectiv...

Copying dynamic library (.dylib) into a framework (.framework)

I have two XCode projects: a framework and a client application. My application depends on my framework and everything works fine with that — the framework is being recompiled everytime the app is, the projects build paths are set correctly, it's completely okay. Now the framework started using 3rd party dylib file, and it's linked aga...

I want to insert the line-feed character in the specified number of characters.

Objective-C:: I want to insert the line-feed character in the specified number of characters. Please teach when knowing. for example NSString str = @"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; ?????? // -> @"aaaaa\naaaaa\naaaaa\n......" ...

Getting “EXC_BAD_ACCESS”

I have an Address interface as this: @interface AddressCard : NSObject { NSString *name; NSString *email; } @property (copy, nonatomic) NSString *name, *email; -(void) print; -(void) setName:(NSString *) theName andEmail:(NSString *) theEmail; -(void) dealloc; @end And implementation as: #import "AddressCard.h" @imple...

touchesMoved:withEvent.

Hi, I got the coordinates of touchesBegan and touchesEnded. But in touchesMoved can I get all the coordinates of the touch from touchesBegan to touchesEnded. I mean that when I put finger on screen and dragged to some position and then I lifted it. So, can I get all the coordinates of the starting position to end position. If possible, ...

how to send and receive files from server in ObjC?

Hi all, How to send and reveice files from a ftp server ? If any sample project or example is there ,then its easy to understand. Thanks ...

determine schema field type in SQLite, CSV, or Excel

I am working on an Cocoa project using SQL databases, or CSV/Excel files as the input. Right now, I have hard-coded the SQL schema for the SQLie files I am importing (For example, the program would know that the first column is a STRING, second column is a INT... etc.). I am wondering if there's any C or Objective-C library or method to...

String Manipulation in Objective-C

Gotten a hold on how to fetch and write to variables in Objective-C, now it's time to learn how to do something more useful with them! Right now, I'm primarily trying to figure out how string manipulation works. In particular, I'm looking for the following functions: Concatenation Finding the length of a string (especially multi-byte...

about webview in uitableview's cell

Objective-C:: 1. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 2. static NSString *CellIdentifier = @"Cell"; 3. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 4. if (cell == nil) { 5. cell = [[[UITableViewCe...

import CSV into SQLite WITHOUT a table schema

I know that I can import .csv file into a pre-existing table in a sqlite database through: .import filename.csv tablename However, is there such method/library that can automatically create the table (and its schema), so that I don't have to manually define: column1 = string, column2 = int ....etc. Or, maybe we can import everything ...