cocoa-touch

How to determine the content size of a UIWebView?

妖精的绣舞 提交于 2019-12-27 09:02:07
问题 I have a UIWebView with different (single page) content. I'd like to find out the CGSize of the content to resize my parent views appropriately. The obvious -sizeThatFits: unfortunately just returns the current frame size of the webView. 回答1: It turned out that my first guess using -sizeThatFits: was not completely wrong. It seems to work, but only if the frame of the webView is set to a minimal size prior to sending -sizeThatFits: . After that we can correct the wrong frame size by the

Number of days between two NSDates [duplicate]

一世执手 提交于 2019-12-27 09:00:10
问题 This question already has answers here : Objective C - calculating the number of days between two dates (6 answers) Closed 4 years ago . How could I determine the number of days between two NSDate values (taking into consideration time as well)? The NSDate values are in whatever form [NSDate date] takes. Specifically, when a user enters the inactive state in my iPhone app, I store the following value: exitDate = [NSDate date]; And when they open the app back up, I get the current time: NSDate

Navigation Bar gets funky if Swipe Gesture and Back Button are triggered at the same time

孤街浪徒 提交于 2019-12-26 14:47:28
问题 Today one of our testers showed me that if he presses the back button of a navigation bar while swiping back creates a quite interesting behavior of the navigation bar: if we are on the third view controller and perform this than go back to the top, than again go in one level and click the back button on most cases the navigation bar will not disappear if it should, or it maybe will not animate. Or not appear in deeper levels. Or deactivate the back button although not being in the top view

How to create a view which contain image and text as like newspaper has?

人盡茶涼 提交于 2019-12-25 20:08:11
问题 I want to create a view which contains image and text, like a newspaper has. For example, in 320 pixel width, a 200 x 100 image. The image is on the left side of the view, and the remaining space on the right side and bottom will contain text. 回答1: You arrange UIImageViews and UITextViews in the way you want them by setting their frames. Then assign images to the imageViews and text to the textViews. 回答2: Well you can 3 options: Create a layout with UIIImageViews and UITextView Use HTML and

How to create a view which contain image and text as like newspaper has?

北城余情 提交于 2019-12-25 20:06:25
问题 I want to create a view which contains image and text, like a newspaper has. For example, in 320 pixel width, a 200 x 100 image. The image is on the left side of the view, and the remaining space on the right side and bottom will contain text. 回答1: You arrange UIImageViews and UITextViews in the way you want them by setting their frames. Then assign images to the imageViews and text to the textViews. 回答2: Well you can 3 options: Create a layout with UIIImageViews and UITextView Use HTML and

issue with array in didSelectRowAtIndexPath. Out of bounds

社会主义新天地 提交于 2019-12-25 18:37:04
问题 I am trying to push to final view where the whole information about item will be shown. - (void)tableView:(UITableView *)atableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { Item *itemObj; //object that holds data for cell for current view ItemShow *itemOverViewObj; //data object for the next view if(atableView==self.tableView) { //ordinary tabeView itemObj=[self.itemsArray objectAtIndex:[indexPath row]]; } else { //filtered with search tableView itemObj=[self.filteredItems

Create a UISlider progress bar and timer (like iPod player) within app

余生长醉 提交于 2019-12-25 18:34:02
问题 I've searched Google and StackOverflow for two days and have yet to find a clear, concise answer. My goal is to create a slider/progress bar that allows the user to scrub to a different part of the song, with two labels on either side, one showing the elapsed time and the other, the time left on the song. I'm using DiracAudioPlayer, which also incorporates AVAudioPlayer functionality. Any help or direction to a tutorial is greatly appreciated. 回答1: Not sure if this is an issue with doing the

Retrieving hours in 24 hour format in iphone

浪子不回头ぞ 提交于 2019-12-25 18:25:07
问题 I am using this format to get hours NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; dateFormatter.dateFormat = @"hh"; [dateFormatter setTimeZone:[NSTimeZone systemTimeZone]]; NSString *date = [dateFormatter stringFromDate:now]; NSInteger myHour = [date intValue]; The problem is it returns e.g 4Pm i Want it to return 16 Instead of 4. How can I do that? I tried replacing hh by single h by of no avail. 回答1: Here Your input: NSDateFormatter *dateFormatter = [[NSDateFormatter

Are there any tools or good techniques to find out where the performance bottlenecks are in an iPhone application?

巧了我就是萌 提交于 2019-12-25 18:19:55
问题 I have an app that's half way done. The performance is not really good, and I wonder where the bottlenecks are. Although I can go ahead and start commenting out suspected lines of code, I wonder if there are any tools that would tell me which method cool took how long and what happened next. The stack trace isn't really that helpful. I had a weird idea to convert the stack trace into an GraphViz graph, to see visually the whole picture. I know some guys at IBM did something similar that

Download / retrieve pdf with asihttprequest

断了今生、忘了曾经 提交于 2019-12-25 18:18:31
问题 I'm trying to download content with an URL to a local file system in my iPad (cachedDir ? ) with this function: - (IBAction)download:(id)sender { NSURL *url = [NSURL URLWithString:@"http:www.google.de"]; ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; [request setDelegate:self]; [request startAsynchronous]; [request setDownloadDestinationPath:@"/Users/ben/Desktop/my_file.pdf"]; // Which //directory?? } Which directory do I have to choose for my path if I want to store the data