How to get UIWebView to work properly? - iphone

I have been searching around the web for a couple of days to find a tutorial on how to get UiWebView to work with the latest version of xcode.
So far all the newest tutorias tells me to control drag my UiWebView into the .h file, but it wont let me do that.
(First Picture) Showing the problem with control dragging.
http://i.imgur.com/TUGb5.png
Then I tried to manually write the code as seen in the tutorials.
(Second picture) Showing the manually written code.
http://i.imgur.com/iRbUF.png
But it still does not load, just just shows a blank white screen???
Many interwebs to the one that can help me! :)

What you need to do is have them both..
So follow these steps ..
Add a UIWebView to the view in Interface builder
Click and drag from the WebView to the #interface class and you will see a small pop up saying add Outlet
Now release the click ..and it will ask you to name the Outlet
After you have named it(let say mywebView ) ..change
[webView loadrequest:];
to
[mywebView loadrequest:];

Related

Cannot connect UIImageView with ViewController. Did they change that?

This is my first time being on this forum. It's nice to be here and i really want to thank you all for the educational lessons you are giving!
So i am suffering from this issue :
i am using Xcode 7 and i did try with the latest Xcode of yosemite(6.4 version) and it seems i cannot establish an outlet connection via the old ctrl and drag method to connect a UIImageView with the ViewController. i did search the net a bit and i found some "solutions" of doing a reference to the header file but it didn't work. Did this method got removed and if yes how are we connecting now an element with the ViewController? is something wrong with my Xcode and if yes how can i fix it?
really appreciate your help!
First of all create outlet object
than go to storyboard or xib.
right click on file's owner (yellow box on top of xib).
you get all the outlet than click on circle right side of your outlet and map with UI by dragging the line.
hope this help you.
in this method you have to create outlet manually.
So yeah i did manage to fix the issue. It appears there is a bug with swift and Xcode and i can tell it happens in all Xcode version 6 and up including Xcode 7. I don't know what exactly occurs this bug and i can't really link an element from scoreboard with ViewController via the simple ctrl drag and drop method but in order to fix i had to reimplent the tableView and reconfigure my elements. this did the trick and i was able to just ctrl drag and drop. if someone knows what occurs this issue please comment!!
thanks

WatchKit Extension[4608:145616] Unable to find image named "hello" on Watch

Problem:
Trying to set the WKInterfaceLabel text using xCode 6.2 but it returns this error:
WatchKit Extension[4608:145616] Unable to find image named "hello" on Watch
Code:
#IBOutlet var lblPassword: WKInterfaceLabel!
lblPassword.setText("hello")
Cleaning the project doesn't seem to fix the issue for me. But if you click on the image file, you'll see "Target Membership" options on the right pane. Select all of them, Clean the build and try again.
I got the same error although I am pretty sure these image files exist.
I just terminated Xcode, relaunched it, cleaned the project (command + K) and built it. It started to work again.
I do this routine whenever I face a new problem. It solves most of the problems as you might know. Sorry if you have done it already.
I supposed that you adding image to asset catalog in WatchKit Extension. This is wrong.You should add that image to asset catalog in WatchKit App. Sorry i can't add image here.
Try as I might, my images were not loaded up to the watch until I did it directly by 'caching' as follows in my InterfaceController in the WatchKit Extension:
[[WKInterfaceDevice currentDevice] addCachedImage:[UIImage imageNamed:#"carrota.png"] name:#"carrot"];
[self.portfiolioImage setImageNamed:#"carrot"];
For me, it looks like you have added "hello" as an image name somewhere in the storyboard.
Use XCode's Find dialog to look for "hello". It will show use as an image name, too.
Screen Shot 1
Ok So the keything to note here is that "you do not want to drag and drop the images into the AssetCatalog"......the only way this worked for me was to manually right click on the catalog (as shown in screen shot 1 and "Add Files"....look for the image you want to add on your local/external drive (Making Sure that only the "WatchKit App" Checkmark is selected in the Add to Targets Section" as shown in Screen Shot 2) and add the images!!
Screen Shot 2
i've had the exact same problem. solution: i've exedently connected the group parenting the WKInterfaceLabel. Try setting YOURSUPPOSEDLABLE.setTextColor(.brown), if the Background of it changes, you have connected the group.
So in my case I had copied and pasted a prior row and assigned a diff class.
That duplicated row's group still had an IBOutlet connection to the prior class that I did not catch.
Once I removed that connection this stupid issue resolved itself and I was able to successfully call .setText()

Dragging image in touches moved gets slow

I am working in an app in which i need to drag the images(i have more than 100 images).Now it is working fine in ios 5 but when i use that same code for ios6 ,it works fine in simulator but slow down in device,It moves quite jerky.
What can i do to move the images smoothly.
For 100's of image you must implement lazy loading or asynchronous task using SDWebImage like Bellow:-
As per my suggestion I am doing asynchronous using SDWebImages A Link of GitHubproject
And I configure this like below steps:-
you need to first right click on your project name:->add files to yourProject-> selected SDWebImageproject and add them
NOTE:- please do not check copy option
now click on project name in Your xcode going to build phases:->target dependencies:-> click on + button and add SDWebimage ARC
now select link binary with library click + button add libSDWebimageARC.a and again click + and add imageIO.framework and also add libxml2.dylib thats it
going to Build setting:->other link flag:-> add -ObjC
and header search path add this three item
1 /usr/include/libxml2
2 "$(OBJROOT)/UninstalledProducts/include"
3 "$(TARGET_BUILD_DIR)/usr/local/lib/include"
now build and run its working like smoothly cheers.... :)
It's more easy and very useful task for loading images and its store catch also so you got more speedy work.
And you can asynchronous images with just two line of code like
In .m :-
#import <SDWebImage/UIImageView+WebCache.h>
NSString *strUrlSting =[d valueForKey:#"Current_RequestUser_Image"];
strUrlSting =[strUrlSting stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSURL* url = [NSURL URLWithString:strUrlSting];
[imgView_user1 setImageWithURL:url
placeholderImage:[UIImage imageNamed:#"placeholder.png"]];
and for Move image related demos and links please download this demo and check it :-
https://github.com/elc/iCodeBlogDemoPhotoBoard
hope it's help's you
here are some same Asked Question please visit link:-
Drag + Rotation using UIPanGestureRecognizer touch getting off track
swapping images using pan gesture
How to use UIPanGestureRecognizer to move object? iPhone/iPad

App crashes when trying to use UITableView

When launching my tab-based app, it crash when I'm trying to navigate to a tab with a UITableView in it, probably due to Interface Builder wrong connection I've made.
I have absolutely no idea why... I'm getting crazy over here!
I've simplified my code so now it contains 2 tabs; when trying to navigate to the non-active tab, the app crashes with no further explanation.
I've posted the simplified source here: source download.
Any help will b appreciated.
Load the name of the UIViewController in tab. VideosGalleryViewController was not mentioned in the class. Check the screen shot attached.

PhoneGapHtml5_Problem

Just wanted to ask u how do we link HTML file in PhoneGap Applications.As u know that in when we create PhoneGap application one Html file comes with it i just want to know how it is linked to the application so that i could add more Html files to it and use it ib webview
Thanks all in advance
To use multiple pages you can just link to them as normal. (Remember, use relative links).
It's hower normal to use only 1 page in phonegap application. 1 page that uses hidden divs. Don't really know why, besides the fact symbian only supports 1 page with acces to the device.
Just place your HTML files and other resouces (like images, scripts, etc) inside the "www" folder :) as Erik said, just link them as yoiu normally do. You don't need to edit any Objective-C files (like .m or .h).
Good Luck
PhoneGapDelegate.m is where the phonegap settings are stored. The PhoneGapViewController.m is where the UIWebView is bound to the xib.
Please control click on any web view delegate method placed in App delegate method then in the new class which appears after contrl clicking make following changes...
(NSString*) wwwFolderName { return #"www"; }
(NSString*) startPage { return #"index.html"; }
In these 2 functions i.e wht html file u want to attach in your phone gap u can write the name in start page function as shown above.