cocoa-touch

How can I create a custom popup window for iPhone?

那年仲夏 提交于 2020-01-01 08:52:46
问题 I want to create a custom popup window for iPhone which should look like this: What is the most correct way to implement this for iPhone and iPod devices? 回答1: The best way to do this is using a UIActionSheet. The code is here: UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:@"Share" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Facebook",@"Twitter", nil]; [actionSheet showInView:self.view]; A UIActionSheet comes from the bottom to

Custom UIAlertView?

点点圈 提交于 2020-01-01 08:47:09
问题 Seeing as the blue doesn't go with my UI interface, im just wondering if there is a way to change the colour of the uialertview, or use a image instead. With all the buttons, 'dismiss' etc still there Thanks 回答1: The fine folks at CodeCropper just put out an open-source control that lets you create custom alert views. It's awesome. https://github.com/gpambrozio/BlockAlertsAnd-ActionSheets 回答2: You could try presenting a Modal View Controller with a transparent background. ModalViewController

Custom UIAlertView?

拜拜、爱过 提交于 2020-01-01 08:46:35
问题 Seeing as the blue doesn't go with my UI interface, im just wondering if there is a way to change the colour of the uialertview, or use a image instead. With all the buttons, 'dismiss' etc still there Thanks 回答1: The fine folks at CodeCropper just put out an open-source control that lets you create custom alert views. It's awesome. https://github.com/gpambrozio/BlockAlertsAnd-ActionSheets 回答2: You could try presenting a Modal View Controller with a transparent background. ModalViewController

UIView scale to 0 using CGAffineTransformMakeScale

∥☆過路亽.° 提交于 2020-01-01 08:45:09
问题 Is it possible to scale a UIView down to 0 (width and height is 0) using CGAffineTransformMakeScale? view.transform = CGAffineTransformMakeScale(0.0f, 0.0f); Why would this throw an error of " <Error>: CGAffineTransformInvert: singular matrix. " ? Update: There is another way of scaling down a UIView to 0 [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.3]; view.frame = CGRectMake(view.center.x, view.center.y, 0, 0); [UIView commitAnimations]; 回答1: There are lots of

AlamofireImage af_setImageWithURL in a UITableViewCell without placeholder image

狂风中的少年 提交于 2020-01-01 08:43:28
问题 I'm using AlamofireImage to set an image on a UIImageView in a UITableViewCell like so: cell.imageView.af_setImageWithURL(url) The image doesn't show after downloading. It will show the image the second time when it's loaded from the memory cache. It seems that using a placeholder image makes all the difference. This works and prints the address of the (downloaded) image: cell.imageView.af_setImageWithURL(URL, placeholderImage: UIImage(named: "placeholder"), filter: nil, imageTransition:

Why not throw an exception if [super init] returns nil?

时光总嘲笑我的痴心妄想 提交于 2020-01-01 08:38:47
问题 This is considered typical - (id)init { self = [super init]; if (self) { // <#initializations#> } return self; } but wouldn't it be better to go with something like this which actually responds appropriately? - (id)init { self = [super init]; if (self) { // <#initializations#> } else { @throw [NSException exceptionWithName:NSInternalInconsistencyException reason:@"you think your constructor is executing, but it's not"] userInfo:nil] } return self; } The corollary to this question is, "under

Scrolling in a UIScrollView without triggering touchesCancelled

送分小仙女□ 提交于 2020-01-01 08:35:31
问题 Overview I'm working on an iPhone game whose code I inherited from another developer. The gaming grid is a UIScrollView having a contentSize of 1000x1000. The grid contains several elements drawn on the screen via OpenGL's Texture2D class. The UIScrollView scrolls in the direction opposite of that in which your finger is moving. The idea behind this is to simulate the act of "sifting" through the elements with your finger, as each element in the path of your touch is supposed to be affected

Is it possible to have both an iOS app and Mac app in the same project?

给你一囗甜甜゛ 提交于 2020-01-01 08:29:07
问题 As the title says, I'm wondering if it's possible and reasonable to have both an iOS app and Mac app in the same project. That is, an Xcode project that has a Mac app target, and an iOS target. If so, what should I watch out for, and is this even a good idea. A little context: I'm working on a client app for a web-service, that will share a lot of the API connection (model-layer) code between the iOS and Mac platforms. 回答1: It's quite straightforward to do this. Make sure you have the build

Repeat count for UIView block-based animation

穿精又带淫゛_ 提交于 2020-01-01 08:21:11
问题 I've looked at the methods for block based animation and noticed there is no equivalent parameter or option for [UIView setAnimationRepeatCount:] . What's the simplest way to repeat an animation a fixed number of times? Do you, for instance, chain them using the completion block? 回答1: Set a completion callback - re-initiate the animation in it - and keep track of the counter yourself. 回答2: I just asked a similar question and then I read the 2010-11-15 release of the View Programming Guide for

How do you create a copy of an UIImageView instance?

佐手、 提交于 2020-01-01 08:19:12
问题 How do I create a copy of an UIImageView instance that can be manipulated independently of the first instance? I've tried UIImageView *tempCopy = [instance copy] but it crashes. Is there another way? 回答1: It probably crashes because UIImageView doesn't conform to the NSCopying protocol. So do it yourself: instantiate a new UIImageView and set any property from your original that you find of interest. 回答2: UIImageView doesn't conform to NSCopying , but it does conform to NSCoding . Archive