cocoa-touch

Retrieve and change the point at which touchUpInside changes to touchUpOutside

末鹿安然 提交于 2020-01-05 20:21:05
问题 I have made a UISlider work just like the "slide to unlock" slider. What I need to do is determine the point at which lifting your finger off is classed as touchUpOUTSIDE and not touchUpINSIDE . This is the point where you slide your finger past the end of the slider too far. I guess it's the same as with a UIButton , you can press the button then slide your finger off the button and depending how far you go, it can still be classed as touchUpInside . If possible, i'd like to mark the target

Center of bounds

独自空忆成欢 提交于 2020-01-05 19:26:22
问题 I have a full screen UIScrollView to display my image, which employ some codes from PhotoScroller.app from apple sample code. I am little confused on the obtaining of the center point of the imageScrollView's bounds. ImageScrollView.m - (CGPoint)pointToCenterAfterRotation { NSLog(@"imageScrollView frame X and Y are %f and %f ",self.frame.origin.x, self.frame.origin.y); NSLog(@"imageScrollView frame Width and Height are %f and %f ",self.frame.size.width, self.frame.size.height); NSLog(@

Core Data Saving Attributes Of Entities

南笙酒味 提交于 2020-01-05 15:07:13
问题 This question is about Core Data. I created a Entity called TV with three attributes called name , price and size . I also created a subclass of NSMutableObject with TV.h and TV.m files. I imported the TV.h to my DetailViewController.h which handles my sliders und UIElements I want to take the values of. So I did a fetch request, and everything works fine, BUT : Everytime I update the UISlider (valueDidChange:), Xcode creates a COPY of my entity and adds it to my TV-Object . All I want Xcode

Is it possible for search for nearby restaurants and bars via API for iPhone SDK? [duplicate]

北城以北 提交于 2020-01-05 10:25:13
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: how to find restaurant list near current location using mapkit in iphone How to find out the near by restaurants using current location details I would like to know if it is possible to search nearby restaurants via ANY API for iPhone SDK? Thanks! 回答1: You have google Places API and SimpleGeo API http://code.google.com/apis/maps/documentation/places/ https://simplegeo.com/docs/ 回答2: You can refer the Yelp API

Arrays of enums are enums in Swift?

北城以北 提交于 2020-01-05 10:17:31
问题 I'm following Apple's Swift/iOS tutorial and it features this line of code: button.setImage( filledStarImage, forState: [UIControlState.Highlighted, UIControlState.Selected] ) But the definition of UIButton.setImage 's signature is: public func setImage(image: UIImage?, forState state: UIControlState) There is no overload of setImage that accepts an [UIControlState]() array. Obviously some voodoo is going on, can anyone explain? 回答1: In Swift, the UIControlState is not, per se, an enum, but

How to draw an NSString with an specific height on to an perfectly matching bitmap?

时光总嘲笑我的痴心妄想 提交于 2020-01-05 10:04:04
问题 I have an NSString like @"Hello World" and want to convert that into an bitmap with exactly 20 pixels height. The width of the bitmap should match the width of the text. I know there are some NSString UIKit additions that can draw text, but I don't know how to draw the text with an bounding box of exactly 20 pixels height (text fits perfectly into this height) into an bitmap that has the perfect size to carry the text? Is there an easy way to do this? This must also work with Chinese,

How to draw an NSString with an specific height on to an perfectly matching bitmap?

半世苍凉 提交于 2020-01-05 10:04:01
问题 I have an NSString like @"Hello World" and want to convert that into an bitmap with exactly 20 pixels height. The width of the bitmap should match the width of the text. I know there are some NSString UIKit additions that can draw text, but I don't know how to draw the text with an bounding box of exactly 20 pixels height (text fits perfectly into this height) into an bitmap that has the perfect size to carry the text? Is there an easy way to do this? This must also work with Chinese,

How save CGContextRef as .PNG file?

ぐ巨炮叔叔 提交于 2020-01-05 08:50:13
问题 I create a drawing iOS application in which I would like to create a "Save Image" method. The drawing takes place inside the touchesMoved: method. - (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; [self drawToCache:touch]; [self setNeedsDisplay]; } - (void) drawToCache:(UITouch*)touch { hue += 0.005; if(hue > 1.0) hue = 0.0; UIColor *color = [UIColor colorWithHue:hue saturation:0.7 brightness:1.0 alpha:1.0];

When Scrolling a table view cell out of view, cell text changes

杀马特。学长 韩版系。学妹 提交于 2020-01-05 08:45:12
问题 I have a UITableView and i programatically add two buttons to the cell. 1 button adds to the cells text ( counts up ) the other subtracts 1 (counts down). However, lets say i add 4, the cell's text will be 4 , but when i scroll that cell up and out of the view, when it comes back down into view, the cells text is back to 1 which is where it started out. The same happens if i add(it does the same if i subtract also) to the cells text and switch pages and then go back to the table view. Here is

How to customize the appearance of a tab bar?

帅比萌擦擦* 提交于 2020-01-05 08:26:51
问题 I am looking to customize the appearance of a tab bar. Specifically I want to: Change the default tabBar color Add a custom image on top of the tabBar Add custom images to tabBarButtons Change the font of tabBarButtons In a nutshell, I want all of the functionality of a tab bar but with a completely custom look. Should I start subclassing elements, or using categories or what? 回答1: When faced with this situation I've just written a custom class (subclassing UIViewController) and used buttons