cocoa-touch

implementing protocol methods in objective-c

If I have an protocol (say UIPickerViewDataSource) and I implement its required methods, do I need to declare those methods in the header file of my class? At the moment I'm not doing so and I get a warning of incomplete implementation (although everything works fine). If I do add the required methods in the then I don't get such warnin...

Where should I perform a Reachability check?

I want to check for a valid network connection. I followed Apple's Reachability example and put my check in applicationDidFinishLaunching #pragma mark - #pragma mark Application lifecycle - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if(getenv("NSZombieEn...

resize and crop image centered

Hi, so currently i'm trying to crop and resize a picture to fit it into a specific size without loosing the ratio. a small image to show what i mean: i played a bit with vocaro's categories but they don't work with png's and have problems with gifs. also the image doesn't get cropped. does anyone have a suggestion how to do this re...

Dealing With Cookies and Reddit on the iPhone

I'm building a Reddit client, for the iPad and the iPhone. I know there's some other clients, but I have some really cool ideas for tabbed Reddit browsing :D Anywho, I'm working on the back-end of the thing first, and was wondering what the best way to deal with my cookie would be. I'm using ASIFormDataRequest and ASIHTTPRequest to get ...

Using a UIWebView to display and watch a log.

My app is retrieving text from a web service in chunks. I am displaying the formatted text using a UIWebView. So far so good. My problem is as each chunk arrives, I need to refresh the web view with the new content. I am using KVO to observe changes in the text, and when the text changes I'm calling [self loadHTMLString:self.log.text b...

UIPageControl , white dot does not get highlighted

Hey guys , I am using the UIPagecontrol with a scrollview. It works well , but there is this one scenario the white does not get highlighted. It happens after we go to a another view from the scrollview and then comes back and reload data. The white does not appear but the number of pages appear correctly. But it gets highlighted ,if I s...

How to USE external C functions in Objective-C with UITextField and UITextView ;-)

Hello, Again I'm trying to wrap my head around Objective-C and Cocoa. So I've posted some code below. What I'm trying to do is basically use the function "th_brk_line" by entering text into a UITextField then displaying it into a UITextView once it has been processed by "th_brk_line". I've posted the external function definition and the...

How do I obtain information about the pages in a UIScrollView?

I have a run of about 10 different methods, they all pass "page" and "index" between them in order to define a ScrollView with multiple pages. The majority of these methods run within a loop (for each page). I'm working on a way to re-orient and re-position the pages depending on the device orientation. My trouble now is trying to get a...

UIControl: Touch Up Inside work but Touch Up Outside does not

I have an UIView that in front of a bigger UIView, I want to hide that current View when tap on the behind View but I can't get Touch Up Outside event work, Touch Up Inside that View work fine. (The behind View have another controls) Thanks Tung Do ...

XCode Static Analyzer: Analyzer skipped this file due to parse errors

I have been able to run the Static Analyzer on my code fine for months. All of a sudden now I am getting the error: <command line>:0:0 Analyzer skipped this file due to parse errors Not sure how to diagnose. The first tile it skips is: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library...

Checking for nil before releasing an object

Is this good or bad practice? if (!theConnection && !receivedData) { // release the connection, and the data object [theConnection release]; // receivedData is declared as a method instance elsewhere [receivedData release]; } ...

I am Using the default UITableViewCell .I want to set the image on cell from my local server...cell.imageView.image

BLImageCache *sharedImageCache = [BLImageCache sharedInstance]; NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:indexPath ,@"IndexPath", nil] ; NSString *urlString; urlString = [[mNewsArray objectAtIndex:indexPath.row] objectForKey:@"imgUrl"]; urlString =[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8Str...

Dealing with editable items in a filtered UITable with an NSMutableArray copy

I have a UITable with a datasource that is set to a 'copy' of the original data. I use this copy to displayed filtered results (either 'All' or only those that are 'checked' with a UISwitch in each row). My logic for doing the filtering is here: -(void)filterItems { [tableData removeAllObjects]; if (checkedOrNotSwitch.selectedSegmentInd...

-[NSCFString objectAtIndex:]: unrecognized selector

I have this little problem I couldn't find in Google: UITableView works fine until I start scrolling. Error Message: `-[NSCFString objectAtIndex:]: unrecognized selector sent to instance 0x5f24870 ` Method: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString...

Is this a memory leak?

Hi all, I have the following 2 code snippets. Assume I have a Parent class and in Parent.h class I have @property (retain) NSMutableArray *childrens; and I have synthesize it in the .m file correctly. assume in Parent.m file -(void) dealloc { [childrens release]; [super dealloc]; } In another class I declare like this. 1. P...

iphone simulator and "DONE" keyboard button for UITextField

Hello, I have problem probably the same like this guy: When clicking on text field, after entering data, "done" button doesn't work?? Is it iphone simulator issue? Please tell me how to get the "done" button work with Interface Builder only. Solution: After googling for 50min I finally understood my problem. And now in plain english...

Running activity indicator NOW

I want to start an activity indicator before going to disk I/O. How do I start the indicator NOW, instead of waiting for the next display loop cycle? Or how do I force the display loop before beginning the disk I/O? Dan ...

Orientation is being incorrectly changed in an iPad Application

I have an application that starts with a Login screen (UIViewController) and then once the user completes the login, the rest of the application is managed by a SplitViewController. The problem I'm having is that when the SplitViewController is first displayed, it overwrites the current screen orientation, it forces portrait mode even if...

iPhone: Is there a way of keeping track of touches while changing views with UINavigationController ?

I'm currently working with 2 views on a UINavigationController. I have a Leaves view (Tom Brow's leaves project) to simulate curling effect for pages which only works with images, and my actual view controller with the page and it's contents. What I'm trying to do is, when tapped on certain place, popViewControllerAnimated:NO the actua...

The graphing in Apple's stock app

Is the graphing portion of Apple's "Stocks" iPhone application available to developers? My guess would be that it is not. If I am right, on a rough scale on 0-100, how difficult would it be to reproduce? (I know this is a silly question, but anyway. Just want some idea.) Also, what framework do you think would be the most suitable for t...