iphone-sdk-3.0

A thin whiteline is been added when resize the image

落花浮王杯 提交于 2019-12-05 11:06:27
问题 When we resizing the image (after downloading and before storing that in document directory), by the following code: -(UIImage *)resizeImage:(UIImage *)image withSize:(CGSize)newSize { float actualHeight = image.size.height; float actualWidth = image.size.width; float imgRatio = actualWidth/actualHeight; float maxRatio = newSize.width/newSize.height; if(imgRatio!=maxRatio){ if(imgRatio < maxRatio){ imgRatio = newSize.width / actualHeight; actualWidth = imgRatio * actualWidth; actualHeight =

iPhone: Can access files in documents directory in Simulator, but not device

自作多情 提交于 2019-12-05 10:40:31
问题 I'm writing an app that copies some contents of the bundle into the applications Document's directory, mainly images and media. I then access this media throughout the app from the Document's directory. This works totally fine in the Simulator, but not on the device. The assets just come up as null. I've done NSLog's and the paths to the files look correct, and I've confirmed that the files exist in the directory by dumping a file listing in the console. Any ideas? Thank you! EDIT Here's the

How do I set the firstresponder?

人走茶凉 提交于 2019-12-05 10:32:24
问题 I have a view built through IB, there's a text view and and button on it. When the view shows up I would like to have the keyboard to be already displayed. I tried to set the first responder in the didViewLoad but that didn't work. I do have an IBOutlet that is connected to the textView and related accessor. 回答1: Looks like you may have accidentally misspelled the method name didViewLoad instead of viewDidLoad . All you should need there (assuming your IBOutlet is connected in IB) is the

ABPeoplePickerNavigationController - remove “Cancel” button without using private methods/properties?

二次信任 提交于 2019-12-05 10:05:46
I'm using the ABPeoplePickerNavigationController, a subclass of UINavigationController, and in the context I'm using it the default nav bar button for the right side, "Cancel", makes no sense. I can't find a way to disable or hide it, and whatever method used needs to be public and store-approvable. Getting rid of the nav bar entirely (picker.navigationBarHidden = YES;) might be an option except that after popping back to the list of contacts the nav bar reappears. Subclassing ABPeoplePickerNavigationController and intercepting viewWillAppear to try and nil the cancel button did not work.

Write only property in Objective-C

江枫思渺然 提交于 2019-12-05 08:41:29
问题 I am stuck with objective-c properties. What I need is to assign a write-only property for a variable, exactly the opposite of readonly, i.e the variable can have setMethod , but it should not have getMethod . I don't know how to do it. answers with some code snippets are appreciated. 回答1: You can do something like: @interface MyClass { @private int _var; } - (void)setVar:(int)newVar; @end @implementation MyClass - (void)setVar:(int)newVar { _var = newVar; } @end Now you can access the

Monotouch set status bar Hidden - API change secure

夙愿已清 提交于 2019-12-05 08:31:49
How can I hide the status bar in a Monotouch application in such a way that it is backwards compatible on iOS 3.X while developing on iOS >= 4.X? Pavel Sich If you ever needed to set the status bar hidden in Monotouch App, and wanted to do it properly for code that runs backward compatible on OS 3.X while developing on iOS SDK 4.X and also for newer devices, here is the answer: if (UIApplication.SharedApplication.RespondsToSelector(new Selector("setStatusBarHidden: withAnimation:"))) UIApplication.SharedApplication.SetStatusBarHidden(true, UIStatusBarAnimation.Fade); else UIApplication

Blending modes on CALayers on screen? Is that possible?

最后都变了- 提交于 2019-12-05 08:24:05
Is that possible to have a CALayer over another one composed using a blending mode on screen? I now that it is possible to do that offscreen using drawinrect, but is it possible to see it live on the screen? thanks for any help. Simple compositing is done for you with CALayers. If the layer is marked as being non-opaque, any transparent or translucent areas will allow content from layers behind the current one to show through. On the Mac, Core Image filters can be used to add effects to this process via the compositingFilter , backgroundFilter , or filters properties. However, Core Image is

Unable to add contact in group using ABGroupAddMember in iphone?

独自空忆成欢 提交于 2019-12-05 07:38:55
问题 I am using the following code but still its not able to add contact information in group and one more thing it always use to create new group. i also want to check that exisiting gruop is avaialble or not !!!! Unable to add contact in group !! ABRecordRef group = ABGroupCreate(); //create a group ABRecordSetValue(group, kABGroupNameProperty,@"My Group", &error); // set group's name ABGroupAddMember(group, person, &error); // add the person to the group ABAddressBookAddRecord(addressBook,

How can I make a iPhone app compatible to 2.2.1 and 3.1 SDK?

天涯浪子 提交于 2019-12-05 07:28:36
问题 I have made some apps in 2.2.1 now when I run the same app in 3.1 it gives errors. Changing the codes is a solution I am not looking for. I am looking for some pre-processor directives that can make my app compatible to both SDKs. Something like #ifdef . Thank You All. 回答1: Similar to How to target a specific iPhone version? You can use this #define to change what you build for each SDK... #if __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_2_2 // iPhone 3.0 code here #endif And do this at run

How to add navigation controller programmatically?

最后都变了- 提交于 2019-12-05 02:24:28
问题 In my app there is requirement that..I have 6 buttons in a nib, when I press any button a new nib will be loaded into the window according to the button pressed. problem is after loading the new nib If I want to come back to the previous nib (which is having all the buttons) how to add navigation controller? what I am doing now is while loading the new nib when I pressed the button objNewViewController = [[NewViewController alloc] initWithNibName:@"NewViewController" bundle:nil]; [self