cocoa-touch

ios how can user cancel facebook sign in?

╄→гoц情女王★ 提交于 2020-01-04 07:12:08
问题 When a user gets to this screen, there is no way to cancel out of it. What can I do? To get this view in the first place I am running: NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: vid, @"link", vid, @"source", vid, @"picture", @"My Place", @"name", @"YouTube Presentation", @"caption", title, @"description", @"Enjoy this Video", @"message", nil]; [app.facebook dialog:@"stream.publish" andParams:params andDelegate:self]; 回答1: This happens if your FBDialog

How do I preserve the frame of a UIScrollView upon entering foreground?

江枫思渺然 提交于 2020-01-04 06:55:29
问题 This question discusses how to create gaps between views in a UIScrollView. The agreed method is to increase the width of UIScrollView's frame to create gaps between the views which will be scrolled past. However when the scroll view is a subview of a UINavigationController an issue arises. The UINavigationController changes the frame of the UIScrollView after it has been set up in -viewDidLoad . The solution proposed is to alter the frame size in -viewDidAppear , at which point

Making round corners for a UIImage

↘锁芯ラ 提交于 2020-01-04 06:53:25
问题 In my iPhone application I have to show a UIImage with its all four corners curved so that it looks good on the screen. But my image is a rectangular image which cannot be altered at image level as it comes from a third party. With UIImageView I can set the frame. Using code, how can I modify my UIImage to have rounded corners? Any clue? 回答1: try this way: UIImageView *imageView = ...; imageView.layer.cornerRadius = 7; // change this value as per your desire imageView.clipsToBounds = YES; 来源:

Strange behavior of showingDeleteConfirmation on UITableViewCell

雨燕双飞 提交于 2020-01-04 06:52:05
问题 A UITableViewCell has a showingDeleteConfirmation flag that you can read. As the name suggests, this allows you to know if the cell is showing the 'delete' button. There are two ways this delete button can be displayed: Swiping across a row. Entering edit mode for the cell and then pressing the '-' icon on the left of the row. I set up some logging to check the value of this flag in the cell's willTransitionToState: . And I found something that confuses me. In example (1),

How do I enumerate and load resources in an iPhone app?

99封情书 提交于 2020-01-04 06:35:35
问题 I'm trying to populate an NSArray with a collection of images in Resources. However, for maximum flexibility, I'm trying to avoid hard-coding the filenames or even how many files there are. Normally, I'd do something like this example from the sample code at apple: kNumImages = 5; //or whatever NSMutableArray *images; for (i = 1; i <= kNumImages; i++) { NSString *imageName = [NSString stringWithFormat:@"image%d.jpg", i]; [images addObject:[UIImage imageNamed:imageName]; } However, I'm trying

UILabel: applying line break mode to only a portion of the text

心已入冬 提交于 2020-01-04 06:18:14
问题 Consider a long string, such as "Located in beautiful downtown Baltimore City". My label is too small for this text, and currently displays it like this: I would like the location substring to be center truncated without truncating the "Located in" substring , like this: Located in beautiful…ltimore City The UILabel class reference indicates this should be possible: If you want to apply the line break mode to only a portion of the text, create a new attributed string with the desired style

Why won't my UITableViewCell deselect and update its text?

戏子无情 提交于 2020-01-04 06:12:25
问题 I have a UITableView with a list of stories and a cell at the bottom that loads more stories. I am trying to make the "More Stories..." cell deselect and change its text to "Loading..." when clicked. I have searched all over the internet and all over stackoverflow and I cant figure out why my code isnt working right. Right now, when the "More Stories..." cell is clicked, it stays selected and doesnt ever change its text. For those asking, moreStories adds 25 new stories to the bottom of the

Why won't my UITableViewCell deselect and update its text?

混江龙づ霸主 提交于 2020-01-04 06:12:02
问题 I have a UITableView with a list of stories and a cell at the bottom that loads more stories. I am trying to make the "More Stories..." cell deselect and change its text to "Loading..." when clicked. I have searched all over the internet and all over stackoverflow and I cant figure out why my code isnt working right. Right now, when the "More Stories..." cell is clicked, it stays selected and doesnt ever change its text. For those asking, moreStories adds 25 new stories to the bottom of the

long running REST API

元气小坏坏 提交于 2020-01-04 06:09:18
问题 A backend API I need to connect to takes about 3-4 minutes to return a response. The iOS client seems to timeout at exactly 60 seconds (which is the default), and I can't figure out how to extend that time out. I have tried to set the timeoutInterval for the NSURLRequest to a large number, and set the Connection: Keep-Alive header, but I have no luck. Here is the code I am using, omitting some API details: NSURL *url = [NSURL URLWithString:@"myAPI"]; NSMutableURLRequest *request =

Is it possible to resize a UIImage without losing quality?

半世苍凉 提交于 2020-01-04 06:04:09
问题 I have a UIImage that I put in a UIImageView which has a pinch gesture recognizer attached to it which I use to scale the image. When I scale the image in the UIImageView, there is no distortion and it scales perfectly. However, I need to resize the UIImage while not in the UIImageView, and when I do this using the following code, the result is slightly skewed: CGFloat width = self.imageView.frame.size.width; CGFloat height = self.imageView.frame.size.height; UIGraphicsBeginImageContext