uikit

How to flip coordinates when drawing in context?

人走茶凉 提交于 2020-01-01 02:41:06
问题 I create a context from an UIImage, and then I draw into it with CGContextDrawImage(bitmapContext, CGRectMake(0, 0, originalImage.size.width, originalImage.size.height), oImageRef); the image appears upside-down due to the flipped coordinate system in quartz. How can I fix that? 回答1: You should be able to transform the context using something similar to the following: CGContextSaveGState(bitmapContext); CGContextTranslateCTM(bitmapContext, 0.0f, originalImage.size.height); CGContextScaleCTM

UIImageView vs UIView w/ Image - efficiency

喜你入骨 提交于 2019-12-31 22:26:17
问题 This is not really a question about addressing a specific problem but more a request to be pointed in the right direction. I am making an app where I am loading several images (saved as JPGs) onto a screen at the same time and this has to be the way it is, I can't unload any of them because they are all being shown at once. I tried loading 30 images at about 800px*600px resolution naively thinking that it only loads the 'compressed' size of the pictures into memory (this being about 200 KB) -

UITableViewAutomaticDimension not working until scroll

馋奶兔 提交于 2019-12-31 10:46:05
问题 When the Table View is first loaded, all of the visible cells are the estimatedRowHeight. As I scroll down, the cells are being automatically sized properly, and when I scroll back up the cells that were initially estimatedRowHeight are being automatically sized properly. Once the cells are being automatically sized, they don't ever seem to go back to being the estimatedRowHeight. override func viewDidLoad() { super.viewDidLoad() self.navigationItem.backBarButtonItem = UIBarButtonItem(title:

What exactly does bool parameter do in animateWithDuration:animations:completion:

こ雲淡風輕ζ 提交于 2019-12-31 08:10:08
问题 I referred to the DOC and it said: completion ... This block has no return value and takes a single Boolean argument that indicates whether or not the animations actually finished before the completion handler was called. ... But I find that no matter you use the bool parameter or not, the completion: block will always execute after animations: block. Just like the two simple block-based animation code snippets shown below, both of them are doing the same. [UIView animateWithDuration:0.3f

How to detect double-taps on cells in a UICollectionView

一笑奈何 提交于 2019-12-31 08:08:36
问题 I want to respond to double-taps on cells in a UICollectionView, and have a double-tap action cancel cell selection. This is what I've tried: UITapGestureRecognizer *tapRecogniser = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)]; tapRecogniser.numberOfTapsRequired = 2; for (UITapGestureRecognizer *recogniser in [self.collectionView gestureRecognizers]) { [recogniser requireGestureRecognizerToFail:tapRecogniser]; } [self.collectionView

UIButton does not function in collectionView cell

社会主义新天地 提交于 2019-12-31 06:25:08
问题 I am trying to create this collection view cells with kinda paging behavior. In every cell; I made a card flip animation. But flip function does not work. I know that function is OK because; before I create these UICollectionViewCell model, I tried everything in UICollectionView itself and it worked out perfect. But since I need paging behavior, I need multiple pages with card view inside and in every cell when user tabs the card it should flip. So, after I migrated all the code from

Creating a custom UI view class to use as a map annotation

纵然是瞬间 提交于 2019-12-31 05:12:10
问题 I created a custom UIView using storyboard. I don't want this at the coordinates that it is in in my storyboard, but I want to be able to reuse it throughout my app at different locations on a map like this. I also want to be able to update the text in there at the users request, and the number in there should increase whenever the green button is clicked. I also want to customize the image below it, like I learned in this question so that the user annotation has an image and this callout

iOS search bar not showing results

青春壹個敷衍的年華 提交于 2019-12-31 04:04:30
问题 *Update: This actually works, the style for my custom cell hasn't come across and so the cell looks blank. How then do I get the searchResultsTableView to use my custom cell? I have implemented a search bar in my table view. Searching, filtering all work when I debug, but when I enter characters into the search bar, the results do not load or show. This is everything I'm doing: @interface InviteTableViewController ()<UIAlertViewDelegate, UISearchBarDelegate, UISearchDisplayDelegate> @property

Is it possible to dim a UIView but allow touch of elements behind it?

落爺英雄遲暮 提交于 2019-12-31 01:25:32
问题 How would you have a grey overlay on top, but allow to touch buttons beneath it? 回答1: You can set userInteraction of overlay to false . 回答2: As mentioned, you can set userInteractionEnabled to NO . But pay attention: when you create a full screen transparent view, and set its userInteractionEnabled to NO , all the subviews of that view will not be responsive to user actions . If you add a button on your view, it will not respond to user taps! and another problem: if you set the alpha value of

Is it possible to dim a UIView but allow touch of elements behind it?

久未见 提交于 2019-12-31 01:25:13
问题 How would you have a grey overlay on top, but allow to touch buttons beneath it? 回答1: You can set userInteraction of overlay to false . 回答2: As mentioned, you can set userInteractionEnabled to NO . But pay attention: when you create a full screen transparent view, and set its userInteractionEnabled to NO , all the subviews of that view will not be responsive to user actions . If you add a button on your view, it will not respond to user taps! and another problem: if you set the alpha value of