iphone-sdk-3.0

What is the alternative of [NSBundle mainBundle] URLForResource:withExtension: in iOS 3 SDK

拈花ヽ惹草 提交于 2019-12-03 16:04:53
I am developing an iOS app using iOS 4.2 SDK, but I want the app to run on older devices like my iPhone 2G with iOS 3.1.3. I don't know what is the alternative for this code: NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"CoreDataApp" withExtension:@"momd"]; It crashes on my device, because the URLForResource:withExtension: method is iOS 4+. Please help. Thanks. its - NSURL *aFileURL = [NSURL fileURLWithPath: [[NSBundle mainBundle] pathForResource:path ofType:@"aif"]]; You can obtain path to your resource using pathForResource:ofType: method and then convert that path to URL using

Resign First Responder on ScrollView Touch

◇◆丶佛笑我妖孽 提交于 2019-12-03 15:26:22
How can I hide the keyboard on ScrollView touch event... Scenario is like that... ->View ->ScrollView ->Textfield I want to hide the keyboard on touch of scrollView. I tried to override the class for scrollview but still i can't do it. Doing like this will help: @interface MyClass <UIScrollViewDelegate> { } @implementation - (void)viewDidLoad { yourScrollView.delegate = self; } - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { [myTextField resignFirstResponder]; } If you really want to handle the touch event, then you need to subclass the UIScrollView and override the method: -

how to Insert , overwrite audio files -Audio Editing iphone

风流意气都作罢 提交于 2019-12-03 14:45:21
I am developing an application which does audio recording. Now I need to add a feature of editing the recorded audio file... The user should be able to play the audio file & insert recording into that.. cut unwanted audio .. I need the two basic functionality INSERT audio & overwrite existing audio. Is there any inbuilt function? Any useful link related to this will be helpful 来源: https://stackoverflow.com/questions/1584035/how-to-insert-overwrite-audio-files-audio-editing-iphone

iPad Camera Connection kit?

醉酒当歌 提交于 2019-12-03 13:47:32
Does anyone know if it is possible to access the iPad's camera connection kit? I would like to read the files off the connected mass storage device. Would this be possible or is this something that only Apple can do in their apps. Thanks I know this is an old question, but google brought me here so I thought I'd add this link for the next person to come along. The good news is this. USB drives do mount properly and show up in the system as /dev/disk2s1. Yay. You can even add more drives via a hub. The iPad supports both FAT and HFS+ drives. The bad news is this. As iPhone developer Dustin

function with multiple arguments

吃可爱长大的小学妹 提交于 2019-12-03 12:47:13
问题 how to pass multiple arguments in a single function in Objective-C? I want to pass 2 integer values and the return value is also integer. I want to use the new Objective-C syntax, not the old C/C++ syntax. 回答1: In objective-c it is really super easy. Here is the way you would do it in C: int functName(int arg1, int arg2) { // Do something crazy! return someInt; } This still works in objective-c because of it's compatibility with C, but the objective-c way to do it is: // Somewhere in your

How do I add a UIImage to grouped UITableViewCell so it rounds the corners?

…衆ロ難τιáo~ 提交于 2019-12-03 12:07:35
I'm trying to add images to table cells in a grouped UITableView but the corners of the images are not clipped. What's the best way to go about clipping these (besides clipping them in Photoshop? The table contents are dynamic.) For example, the first image in a table would need the top left corner rounded only. This was my solution, which could use a little refactoring: void addRoundedRectToPath(CGContextRef context, CGRect rect, float ovalWidth, float ovalHeight, BOOL top, BOOL bottom) { float fw, fh; if (ovalWidth == 0 || ovalHeight == 0) { CGContextAddRect(context, rect); return; }

How to hide/disable only the first uinavigationbar?

六月ゝ 毕业季﹏ 提交于 2019-12-03 11:34:24
I've been wandering how to hide / remove / disable only the main or first navigation bar in the navigation controller so that I could put an image as a whole background screen but I couldn't find any solution. Did try hide the titleview in viewdidLoad of the main navigation controller but didn't work. Tried using navigationBarHidden but it hides the whole navigation bar for the next stack of controller. So, I'm not sure how to do this. To give you an example, I would like to have something like this app - The Masters Golf Tournament - http://appshopper.com/sports/the-masters-golf-tournament .

game state singleton cocos2d, initWithEncoder always returns null

前提是你 提交于 2019-12-03 10:15:59
I'm trying to write a basic test "game state" singleton in cocos2d, but for some reason upon loading the app, initWithCoder is never called. Any help would be much appreciated, thanks. Here's my singleton GameState.h: #import "cocos2d.h" @interface GameState : NSObject <NSCoding> { NSInteger level, score; Boolean seenInstructions; } @property (readwrite) NSInteger level; @property (readwrite) NSInteger score; @property (readwrite) Boolean seenInstructions; +(GameState *) sharedState; +(void) loadState; +(void) saveState; @end ... and GameState.m: #import "GameState.h" #import "Constants.h"

view .doc, .docx, .rtf, .ppt file in iphone using Webview

◇◆丶佛笑我妖孽 提交于 2019-12-03 10:12:32
问题 I want to view .doc, .docx, .rtf, .ppt file in iphone. But I guess something is going wrong at my side and its not working for the above formats but my code is working fine for .txt and .pdf files. I have the read the document regarding Webview it states it supports viewing of the above document. below is my snippet for .doc [webView loadData:requestData MIMEType:@"application/msword" textEncodingName:@"UTF-8" baseURL:nil]; for .ppt I am using MIME type as "application/vnd.ms-powerpoint" Note

Stop deceleration of UIScrollView

邮差的信 提交于 2019-12-03 10:03:17
What's the best way to immediately stop the deceleration of an UIScrollView in iPhone 3.0? I would like to keep the deceleration of the UIScrollView until it naturally stops or the user performs a certain action, whatever happens first. Thanks! Untested suggestion coming up:) When the button tap event is caught, you read what the [scrollView contentOffset].x is, and set the offset to this value with animation OFF. 来源: https://stackoverflow.com/questions/2037892/stop-deceleration-of-uiscrollview