uikit

Loading UIImage in background thread causes ImageIO error

ぐ巨炮叔叔 提交于 2019-12-20 15:33:34
问题 I am working on an iOS project that loads UIImages from URLs in a background thread and displays them in a horizontally paged scroll view. This behavior should mimic that of the native photo library application for iPhone. I have everything setup in a way that I believe should work, but upon drawing the UIImages in the main UI graphics context, I occasionally see this message print out in the console: ImageIO: <ERROR> CGImageReadSessionGetCachedImageBlockData ***

Is there a visual guide to the UIKit components?

点点圈 提交于 2019-12-20 12:31:55
问题 My Problem is this, I want to add some component to my App I saw in some other App. Everytime I wnat to do this, I start googling around for the name. It took me some time to find the name of UIActionSheet. Now I'm looking for that transparent overlay that appears when you turn the volume up and down. So, is there a good visual guide to the UIKit components? As an example, see the visual guide to swing components or this visual guide which is way to short/incomplete. And secondly, what's the

UIView performance: opaque, backgroundColor, clearsContextBeforeDrawing?

空扰寡人 提交于 2019-12-20 12:27:04
问题 I'm displaying opaque PNGs with UIImageView s inside of a superview with a white background color. What's best for performance? UIImageView Defaults opaque = NO , backgroundColor = nil , clearsContextBeforeDrawing = YES . iOS Developer Library: UIView Class Reference UIView Class Reference: backgroundColor says, "[ nil ] results in a transparent background color." If I set a UIViews opaque property to YES , must I also set its backgroundColor to [UIColor clearColor] , or is that extra line of

how to determine which tabbar index is my view controller

旧街凉风 提交于 2019-12-20 10:57:28
问题 Can somebody please tell me how I can determine which tabbar index a view controller is at. to simplify - I can jump to a tabBarItem at the moment by hardcoding its index. self.tabBarController.selectedIndex = 3; However, should the user customize the tab bar items, there is a possibility the viewController at number 3 isn't the one that the user will want as it has been moved. How can I determine where it has moved to so I can select the correct one. Any help please. Thanks, Lee 回答1: Use the

Move a UIImageView

跟風遠走 提交于 2019-12-20 10:56:21
问题 What is the best way to move an image along an array of dots? 回答1: My recommended approach would be to wrap the UIImage in a UIImageView and use a CAKeyframeAnimation to animate your UIImageView's layer along a path that passes through your three points: UIImage *image = [UIImage imageNamed:@"image.png"]; imageView = [[UIImageView alloc] initWithImage:image]; [mainView addSubview:imageView]; // Remember to remove the image view and release it when done with it CAKeyframeAnimation

How to sleep for few milliseconds in swift 2.2?

自作多情 提交于 2019-12-20 10:17:25
问题 please anyone tell me how to use sleep() for few milliseconds in swift 2.2? while (true){ print("sleep for 0.002 seconds.") sleep(0.002) // not working } but while (true){ print("sleep for 2 seconds.") sleep(2) // working } it is working. 回答1: usleep() takes millionths of a second usleep(1000000) //will sleep for 1 second usleep(2000) //will sleep for .002 seconds OR let ms = 1000 usleep(useconds_t(2 * ms)) //will sleep for 2 milliseconds (.002 seconds) OR let second: Double = 1000000 usleep

UIButton flashing animation

两盒软妹~` 提交于 2019-12-20 10:12:09
问题 I was wondering if it was possible to apply a flashing animation to a UIButton. I have searched but only found the code for a pulse animation which changes the size of my UIButton continuously. I instead was thinking about some kind of flashing animation to alert the user he has to press the button. The only approach to the problem I can think of is by changing the alpha constantly using: [self setAlpha:0.5]; ...but it won't be as visible as a flashing button. 回答1: Perhaps not the best way,

UICollectionView horizontal scrolling, deleting last item, animation not working

血红的双手。 提交于 2019-12-20 09:39:59
问题 I have a UICollectionView. It scrolls horizontally, has only a single row of items, and behaves like a paging UIScrollView. I'm making something along the lines of the Safari tab picker, so you can still see the edge of each item. I only have one section. If I delete an item that is not the last item, everything works as expected and a new item slides in from the right. If I delete the last item, then the collection view's scroll position jumps to the N-1th item (doesn't smoothly animate),

How do I make a semi-transparent view layer above a current view?

五迷三道 提交于 2019-12-20 09:37:08
问题 You've likely seen this before, its become exceedingly popular in consumery chic apps like ScoutMob. I'm trying to implement a 60% transparent view on launch that will cover my home screen, explaining how to use the functions of the home screen and disappears on tap. I have my entire app completed (it's using .xib's since its from a years ago, but feel free to explain in storyboard format as well, since I will likely reuse this feature in other iOs 5.0+ applications.) I have no problem making

Tweetie like swipe menu

一曲冷凌霜 提交于 2019-12-20 08:52:13
问题 How can I implement tweetie like swipe menu? I'm done with developing a tableviewcontroller with a customcell. The customcell implements touchesbegan and touchesMoved. It also reports swipe gestures via a selector to the parent tableviewcontroller. Now how should I go about hiding the "Swiped" cell and replacing it with a "swipe menu view" and how should I get the actions from the buttons present on the swipeview? 回答1: Each table view cell has a contentView that encompasses the whole area of