iphone-sdk-3.0

iPhone, how do usa an App Delegate variable so it can be used like global variables?

痴心易碎 提交于 2019-12-10 11:06:28
问题 Heres the code I'm using, see my error afterwards @interface MyAppDelegate : NSObject { NSString *userName; } @property (nonatomic, retain) NSString *userName; ... @end and in the .M file for the App Delegate you would write: @implementation MyAppDelegate @synthesize userName; ... @end Then, whenever you want to fetch or write userName, you would write: MyAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; someClass.someString = appDelegate.userName; //..to fetch

How to play a video from an URL in iphone

冷暖自知 提交于 2019-12-10 10:52:32
问题 I have a video at in url, In a button click I have to play a video, for this I used UIWebView to play this video, for this I used the following code: -(void)viewDidLoad { NSString *string = @"http://www.boxmusiq.com/ThiruvasakamVideo/VTS_01_2_converted.mp4"; youtubeview = [[YouTubeView alloc] initWithStringAsURL:string frame:CGRectMake(0, 0, 320, 480)]; NSLog(@"the url is: %@",string); [self.view addSubview:youtubeview]; } and In YouTubeView.m YouTubeView is a subclass of UIWebView; -

How to detect or define the the orientation of a pinch gesture with UIPinchGestureRecognizer?

限于喜欢 提交于 2019-12-10 10:27:08
问题 I'm using UIPinchGestureRecognizer to detect pinch gestures, something like: - (void) initPinchRecon { UIPinchGestureRecognizer *pinchRecognizer = [[[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(Perform_Pinch:)] autorelease]; [self addGestureRecognizer:pinchRecognizer]; [pinchRecognizer setScale:20.0f]; } - (void) Perform_Pinch:(UIPinchGestureRecognizer*)sender{ NSLog(@"PINCH"); } And it works well to detect a simple pinch gesture: It's possible to determine (or define

Missing frameworks after upgrading to Xcode 3.2

安稳与你 提交于 2019-12-10 10:06:32
问题 I upgraded to Xcode 3.2 and now can't seem to add a number of frameworks, specifically the media player. A number of frameworks do not show up on the "Add Existing Frameworks Sheet". Per another question I tried setting the "Framework Search Path" to $(SDKROOT)/Library/System/Frameworks but that didn't seem to make any difference. The UIKit.framework that is included by default when I create a new project is in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk/System

iPhone Animated Loading Screen

Deadly 提交于 2019-12-10 02:28:31
问题 Is there a way to have an animated loading screen for my iPhone application as opposed to the Default.png that I currently am using? 回答1: In short - no. The purpose of the Default.png is to give the iPhone OS something to display to the user while it loads your application in. The best you can do is to speed up the initial load of your application (say defer your resource loading until after the program is running), then add your own animation while you actually load your resources 'behind

How to draw a triangle with QUARTZ 2D?

做~自己de王妃 提交于 2019-12-09 23:41:07
问题 I'm developing an iPhone app with 3.1.3 SDK. I'm trying to draw a triangle with transparent fill an 1px black stroke with this code: CGContextMoveToPoint(ctx, position.X, position.Y - (size.height / 2)); CGContextAddLineToPoint(ctx, position.X - (size.width / 2), position.Y + (size.height / 2)); CGContextAddLineToPoint(ctx, position.X + (size.width / 2), position.Y + (size.height / 2)); CGContextFillPath(ctx); CGContextSetLineWidth(ctx, 1.0); CGContextStrokePath(ctx);

How to include and use new fonts in iPhone SDK?

好久不见. 提交于 2019-12-09 22:52:58
问题 I want to use font "MgOpen Modata" in my iphone App. But I dont see it in the font list in Property inspector. How do I include that font so that I can use it? 回答1: Add the font files to your resource files Edit your Info.plist : Add a new entry with the key Fonts provided by application . For each of your files, add the file name to this array On the example below, I've added the font "DejaVu Sans Mono": In your application you can the use [UIFont fontWithName:@"DejaVuSansMono-Bold" size:14

What is the difference between a regular and adaptive low pass filter?

南楼画角 提交于 2019-12-09 18:25:37
问题 I've noticed in Apple's accelerometer sample code they use both regular and adaptive low pass filters, what is the difference? 回答1: They are both IIR 1st order low pass filters (simple, and laggy in responsiveness when compared with other DSP techniques). The adaptive filter switches to a higher frequency roll-off (and thus becomes even less smoothing but more responsive) for larger accelerations. There are other higher quality (and more complicated) DSP filtering techniques for motion

Check if user has email set up on their iDevice?

廉价感情. 提交于 2019-12-09 16:20:06
问题 How do you check (programmatically) if a user has set up an email account in Mail.app. It seems to be causing a crash. Cheers 回答1: if ([MFMailComposeViewController canSendMail]) { [self doStuff]; } 回答2: Class mailClass =(NSClassFromString(@"MFMailComposeViewController")); if(mailClass!=nil) { if ([mailClass canSendMail]) { [self displayMailComposerSheet]; //compose box }else { //email account not setup on the device. } }else { // problem in loading mail setup. } 来源: https://stackoverflow.com

invalid entitlements 0xE8008016 when I add the entitlements file

那年仲夏 提交于 2019-12-09 15:53:36
问题 I'm trying to do ad hoc distribution. When I use XCode, the application installs fine on my phone. In preparation for ad hoc distribution, I created the default entitlements file, unchecked the get-task-allow box, added the entitlements file name to the code signing entitlements line, and tried to install on my phone. If I have the file in the entitlements in build settings, I get the (dreaded) error The entitlements specified in your application's Code Signing Entitlements file do not match