天道酬勤,学无止境

ios

Populating input text field in WKWebView

I have loaded the following html page in a WKWebView controlled by a specific view controller. After the view is loaded I would like that the App automatically populates an input text field in the page. In this example I would like the app to write "Hello Result" in the "Result" text field of the form below. <html> <head> <title>Test Page</title> </head> <body> <form> QR Result <input type="text" name="Result" width="20"> </form> </body> </html> This is the code where I load the HTML page as file within the view controller: var htmlFile = NSBundle.mainBundle().pathForResource("apptest", ofType

2021-06-15 18:10:39    分类:问答    ios   swift   wkwebview

UILabel doesn't change height on setFrame

I'm trying to change the height of a UILabel depending on how much text is in the label. I can calculate the size required for the label but when I try to set the UILabel frame it just doesn't change. Below is my code. Even if I replace size.height in the last line to something like 500 the size of the UILabel frame doesn't change - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *simpleTableIdentifier = @"GameItemCell"; GameItemCell *cell = (GameItemCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier]

2021-06-15 18:10:22    分类:问答    iphone   ios   objective-c   cocoa-touch

Suppress warning: Meta method xx in category from xx conflicts with same method from another category

How can I suppress this compiler warning: Meta method 'prefix' in category from '...soap+prefix.o' conflicts with same method from another category ? here is the category soap+Prefix.h: @interface Soap (Prefix) +(NSString*)prefix; @end and soap+prefix.m: #import "Soap.h" #import "Soap+Prefix.h" @implementation Soap (Prefix) +(NSString*)prefix { return @"EInspector"; } @end and these two files by the way are automatically generated with SudZc wrapper for web services. p.s. this warning is issued ONLY in XCode 4.4 thank you so much in advance.

2021-06-15 18:06:50    分类:问答    iphone   ios   xcode

How to use UITableViewCell with UITableViewCellStyle with cell reuse correctly?

I want to use UITableViewCellStyle.Subtitle style for the default table cells. I found an answer in an SO answer like this: func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { var cell:UITableViewCell? = tableView.dequeueReusableCellWithIdentifier("cell") as UITableViewCell? if (cell != nil) { cell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: "cell") } } With the code above, I can successfully use the Subtitle cell style. However, I start to think something might be wrong? Why create a new cell when cell != nil

2021-06-15 18:05:46    分类:问答    ios   objective-c   swift   uitableview

Turn Wifi on/off for iphone from an application

I need to turn on or off the wifi in the iphone. Any ways of doing it? Or is it forbidden (private framework)

2021-06-15 17:57:59    分类:问答    iphone   ios   wifi

How can you get your historic location data from new iPhones with iOS 5 (for personal use)?

It used to be easy to get your historic location data from a file called consolidated.db on an iPhone (see, for example, http://petewarden.github.com/iPhoneTracker/). However, this is more difficult on new iOS systems. Is your data still somewhere on your phone, though, and is it possible to access it? To be clear, I'm not looking to use the location API; rather, I'd like my historic location data as an end-user of my device. Are there any scripts/apps available that can do this for me?

2021-06-15 17:46:52    分类:问答    iphone   ios   location

Adding components to path - Objective C

I have a url say : www.gmail.com/index.php. I also have three different strings say aa, bb and cc. I want to append the three separate strings to the url in order to get a combined url in Objective C i.e I want www.gmail.com/index.php/aa/bb/cc . Can someone help me out ?? I am new to objective C. Thanks.

2021-06-15 17:39:44    分类:问答    iphone   objective-c   ios   xcode   ipad

NSPredicate that filters out subclass results

I have two classes, Company and MyCompany. MyCompany is a subclass of Company, and Company is a subclass of NSManagedObject. I am trying to write a predicate for an NSFetchRequest that will return results of the class Company, but filter out MyCompany objects. I have tried the following (suggested from here https://stackoverflow.com/a/8065935/472344): NSPredicate *predicate = [NSPredicate predicateWithFormat:@"class != %@",NSStringFromClass([myCompany class])]; But I get an error: 'keypath class not found in entity <NSSQLEntity CKCompany id=1>' I also tried (suggested from here https:/

2021-06-15 17:39:38    分类:问答    ios   ios5   nspredicate   nsfetchrequest

Programmatically create a x509 certificate for iPhone without using OpenSSL

Is there a way to programmatically create a self-signed certificate in an app for iPhone just by using the Apple Security framework, ie. not having to mess with OpenSSL?

2021-06-15 17:39:06    分类:问答    ios   ssl   x509certificate   x509

iOS 7 no longer working with XCode 4.6.3

I have XCode version 4.6.3 and have just recently upgraded the OS on my iPhone 4 to iOS 7. When I try to run my code on my device I get the following error: Xcode cannot run using the selected device. No provisioned iOS devices are available with a compatible iOS version. Connect an iOS device with a recent enough version of iOS to run your application or choose an iOS simulator as the destination. In Organizer I'm seeing the following message: The version of iOS on "My Phone's Name" is not supported by this installation of the iOS SDK. Please restore the device to a version of the OS listed

2021-06-15 17:38:13    分类:问答    ios   xcode   ios7   xcode4.6