uikit

Using SpriteKit inside UIKit

Deadly 提交于 2019-12-13 03:23:52
问题 I am contemplating a simple app that has four characters that you can drag around on the screen. While dragging they "wiggle" — that's the animation. And they snap to a position if they get close enough to it... like in a puzzle. Without the animation, this is all simple in UIKit. My first thought is to render each character in its own SKView inside a plain old UIView . I could attach UIGestureRecognizers to each SKView to track tapping and dragging. But I think this implies individual

Xamarin.iOS - Action Sheet Line Numbers

人走茶凉 提交于 2019-12-13 03:15:30
问题 I have this scenario: My action sheets have a variant text size, like in this question, but trying to access this API from xamarin iOS, I cant find the property: UILabel.appearance(whenContainedInInstancesOf: [UIAlertController.self]).numberOfLines = 2 Reading this question, anwsered by @SushiHangover, there are many hidden API's by Xamarin, and with the code, I think I can achieve the desired behavior. So, in Xamarin.iOS, how can I force my action sheet's options to have two or more lines of

Why are sequential UIView animations displayed concurrently?

筅森魡賤 提交于 2019-12-13 03:10:24
问题 I've written some code that moves some objects around on the screen in sequence. As each object finishes moving, the next starts. The code is structured similarly to this: Model: moveObject { // Code to move the object ... [delegate moved:self]; } Delegate: moved:(MyClass *)o { UIView* v = [self viewForObject:o]; [UIView animateWithDuration:1.0 animations:^{ [v setCenter: [model center]]; } completion:^(BOOL finished){ // Move object [model moveObject]; }]; } Although the code seems to run

Is Point Inside Rounded Rectangle?

流过昼夜 提交于 2019-12-13 02:58:45
问题 I have this code to draw rounded rectangles: void ContextAddRoundedRect(CGContextRef ctx, CGRect rect, CGFloat radius) { CGFloat minX = CGRectGetMinX(rect); CGFloat maxX = CGRectGetMaxX(rect); CGFloat minY = CGRectGetMinY(rect); CGFloat maxY = CGRectGetMaxY(rect); CGContextMoveToPoint(ctx, minX + radius, minY); CGContextAddArcToPoint(ctx, maxX, minY, maxX, minY + radius, radius); CGContextAddArcToPoint(ctx, maxX, maxY, maxX - radius, maxY, radius); CGContextAddArcToPoint(ctx, minX, maxY, minX

How to observe when a UIAlertView is displayed?

こ雲淡風輕ζ 提交于 2019-12-13 02:55:57
问题 Is it anyway possible to observe if a UIAlertView is being displayed and call a function when it is. The UIAlertView is not being created and displayed in the same class which I want a function to be called in. Its hard to explain but to put it simply I need to somehow monitor or observe if the view becomes like out of first responder or something because I dont think it is possible to monitor if a UIAlertView is being displayed :/ 回答1: Sounds like a job for notifications. Say that class A

Clear UITableView Cache

梦想的初衷 提交于 2019-12-13 01:21:28
问题 My UITableView data source gets updated in background thread based on user action. And I am reDisplaying cells in foreground. Problem is if number of rows in new data is less than the number of rows in previous data, I can still see old rows listed after the new rows. After 15-20 seconds these old rows are automatically deleted (sometimes it is faster). Or if I go to different screen and comeback to my tableview (with the datasource unchanged), the old rows are no more there. My guess is

iOS dynamically load new cell to the bottom of a tableview

时光怂恿深爱的人放手 提交于 2019-12-13 00:33:47
问题 I'm working on an iOS project where I want to dynamically add more cell to the bottom of the tableview once the user reaches the bottom. I currently have this working by calling a method that fetches more data that is added to the array that I'm using to hold my cells. When I'm done adding the objects to the array I call [tableView reloadData]. This works, but it doesn't visually load the cell until the tableview stops scrolling. I also tried using [tableView insertRowsAtIndexPaths: inSection

in iOS7 how do you stop the First viewcontroller autorotating?

荒凉一梦 提交于 2019-12-13 00:06:51
问题 This question was migrated from Software Engineering Stack Exchange because it can be answered on Stack Overflow. Migrated 5 years ago . I have an app that just needs one screen to autorotate, the first and last screens should be portrait. I can get the last screen to stop rotating using: - (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; } But this does not work on the first screen, I am using a storyboard with a UINavigationController (I'm thinking

iPhone sdk Cocoa Touch - Pass touches down from parent UIView to child UIScrollview

旧城冷巷雨未停 提交于 2019-12-12 23:07:45
问题 I have a UIView inside my xib in IB and inside that is a UIScrollview that is a small 80x80 square and dynamically loaded with 8 or so 80 x 80 thumbnail images. The UIScrollview is not clipping the images so that they extend out either side so you can swipe left and right to scroll a chosen image into the the centre, paging is on so they snap ti each image. I have researched and found this is the best and possibly only way to do this. The UIScrollview sits in a 'container' UIView for one

UITextView initial scroll position is not 0

烈酒焚心 提交于 2019-12-12 20:35:40
问题 I have a UITextView to display the title and content of an article. Here is my code: static func setTextViewRichText(textView: UITextView, html: String, title: String) { do { let titleText = NSAttributedString(string: title + "\n", attributes: [NSFontAttributeName: UIFont(name: "Helvetica", size: 20)!]) let contentText = try NSAttributedString(data: html.dataUsingEncoding(NSUTF8StringEncoding)!, options: [NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType,