cocoa-touch

Core Graphics Line drawing and deleting on touch

孤人 提交于 2020-01-02 00:32:27
问题 I am writing an iPhone application somewhat like pick up sticks app on appstore. I have already done with drawing multiple lines and displaying it using CoreGraphics. But now I am stuck with how to delete the line when the user taps on it. I have searched on Google a lot but didn't find anything related. I have seen this post of yours at some other place and this has really helped me out. but the problem is that if i have a stick and then another stick on top of it. when i click on the stick

Swipe UITableViewCell without touch

放肆的年华 提交于 2020-01-02 00:31:46
问题 As my title saying I want to swipe first row of UITableView left to right when user will come on that ViewController . In my ViewController I have one UITableView , each row have two button "More" and "Delete" action. Look at below code func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { return true } func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) { if (editingStyle ==

Superscripted ordinal suffix in NSString

吃可爱长大的小学妹 提交于 2020-01-02 00:16:09
问题 Is there a way in NSString to output the st, nd, and rd but in a superscripted format? Any known unicode perhaps? 回答1: There doesn't seem to be any Unicode characters for this, but it's easy enough to make an NSAttributedString that will do the trick: NSDictionary * superscriptAttrs = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:1] forKey:NSSuperscriptAttributeName]; NSAttributedString * st = [[NSAttributedString alloc] initWithString:@"st" attributes:superscriptAttrs];

Do an action when a sound has finished playing in AVAudioPlayer?

☆樱花仙子☆ 提交于 2020-01-02 00:15:10
问题 I am using the AVAudioPlayer framework, and I have several sounds that play one at a time. When a sound is finished playing, I want the application to do something. I tried to use audioPlayerDidFinishPlaying to do the action at the end of the first sound, but I couldn't use that for the second sound because I got a redefinition error. Can I use NSTimeInterval to get the duration of a sound? // ViewController.h #import <UIKit/UIKit.h> #import <AVFoundation/AVFoundation.h> #import <AVFoundation

Presenting a modal view controller only after another one has been dismissed

…衆ロ難τιáo~ 提交于 2020-01-01 23:13:04
问题 I can't just do [myViewController dismissModalViewControllerAnimated:YES]; [myViewController presentModalViewController:nextModalViewController animated:YES]; one after the other, because then the two animation blocks try to affect the same references simultaneously and things break badly. So what I need to do is make the latter call only after the first animation has finished. But there's no UIViewControllerDelegate method like didDismissModalViewController . What should I do? 回答1: What's

How can I show a sequence of buttons highlighting?

為{幸葍}努か 提交于 2020-01-01 20:36:12
问题 Similar to the Simon games of old, I want to show the user a button sequence & then have them repeat it back. The place I'm stuck is showing the first button highlighted for, say, 500ms, waiting 100ms, showing the second highlighted for 500ms, waiting another 100ms, showing the 3rd & so on. From other Stackoverflower'ers I've gotten to this block: redButton.highlighted = YES; [UIView beginAnimations:@"" context:nil]; [UIView setAnimationStartDate:[NSDate dateWithTimeIntervalSinceNow:1]];

Right To Left Push animation results in corrupted navigation bar

血红的双手。 提交于 2020-01-01 19:58:23
问题 I'm subclassing my UINavigationController to perform a push from right to left (not normal behavior) with UIRTLNavigationController.m I've added at the bottom of this question and get these warnings: nested push animation can result in corrupted navigation bar Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted. I've researched about these errors and found a class that prevents you from receiving them: https://github.com/Plasma

Right To Left Push animation results in corrupted navigation bar

两盒软妹~` 提交于 2020-01-01 19:58:07
问题 I'm subclassing my UINavigationController to perform a push from right to left (not normal behavior) with UIRTLNavigationController.m I've added at the bottom of this question and get these warnings: nested push animation can result in corrupted navigation bar Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted. I've researched about these errors and found a class that prevents you from receiving them: https://github.com/Plasma

How to pixelize / add pixelating effect to a UIImage in iOS

孤人 提交于 2020-01-01 19:49:07
问题 I am looking for a way to pixelize a UIImage in Cocoa touch. I don't know what the best approach would be (some people have suggested me using OpenGL) but I have a feeling there must exist some other simple way I may be overlooking. Does anyone know of one? 回答1: Signal processing explanation of what to do to the image: Downsample by N Upsample by N Then convolve the image with a NxN box filter (Matlab code to create NxN box filter rect = ones(N,N) ). Comp sci explanation: create an empty new

Detect installed iPhone App using PHP?

牧云@^-^@ 提交于 2020-01-01 19:47:09
问题 is this possible somehow? I would like to redirect to different pages depending on whether the user already installed an app or not. 回答1: It is completely impossible for your server to reliably tell whether an app is installed on the client. (Unless you can associate app users with page viewers by user account) 回答2: Not really possible. You can launch the app using the custom URL scheme but the user will get a Safari error dialog if the app isn't installed. I guess your app could ping the