Dragging image in touches moved gets slow - iphone

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

Related

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()

How to get UIWebView to work properly?

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:];

iPhone action button image file available anywhere?

I'm working on an app and want to use the image from the action type toolbar button (the one with the arrow coming from the box that we often use for share etc) in a custom button. Is there some way I can get hold of the .png for it?
Thanks
There is the open source UIKit artwork extractor project available at Github: https://github.com/0xced/UIKit-Artwork-Extractor
There's a mockup toolkit available for iOS SDK at http://blog.metaspark.com/2009/02/fireworks-toolkit-for-creating-iphone-ui-mockups/
Check the fourth image on right most column. I hope it contains the image you want.
You can download the mockup toolkit and open up with fireworks or photoshop to extract images from there. If you don't have these adobe softwares then the open source software GIMP is your good friend to extract the image.
There really is no need to duplicate the image content since its already in the framework.
Have a look at this code:
UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:#selector(onActionButtonClicked:)];
The relevant portion being the initWithBarButtonSystemItem initialization method.
This question may also be more useful in answering this question than the selected answer.

Images in Interface Builder when using MonoTouch

I'm new to MonoTouch and iPhone development. I have my images (PNG) in a resources folder in MonoDevelop, however if I want to set the image property for a button in Interface Builder, how do I do that? It's always a blank dropdown. Do I need to use XCode to access the XIB file and then somehow embed the button image file I'll need in it?
This is a known limitation of MonoDevelop and Interface Builder. To add images to an XIB in Interface Builder they must be part of an XCode project, which of course coming from MonoDevelop they're not.
To achieve what you're trying to do you will need to set the image via code, and ensure the build action of your image is set to Content. To do this, simply right click your image inside MonoDevelop, and select Build Action > Content.
On your view with the button on it, create an outlet in Interface Builder for your button, hook it up, then from code to set your image, you just need to use the .FromFile("path/name") method of UIImage.
UIImage buttonImage = UIImage.FromFile ("resources/image.png");
myButton.SetBackgroundImage (buttonImage,UIControlState.Normal);
That's off the top of my head, but I think that should do it.
You can manually set the image in Interface Builder, but it wont show up until run time. The image name can include a path, e.g. "images/settings.png".
All solutions given here are completely wrong and misleading. All you need to do, is place your images in the Resources folder (on the project root), and add your images to this folder. After adding files to this folder, mark all files and make sure their build action is set to BundleResource.
I also needed this to work, here is a workaround I found.
You need to create a dummy xcode project. Place it in the same folder as your project.
Add all your xib files and image files to that xcode project by dragging them in when the project is opened in xcode. Now you will be able to see the preview of the images.
The image files must be in the same folder as the project file and xcode must be opened with the dummy project while the interface builder is opened.
Not great - but solves the issue for now.
Here is a sample project I have created.
For this issue to be resolved on the MonoDevelop side - some inter-process communication code needs to be created, I think that a good starting point will be looking for "PBXProjectWatcherServerConnection-3.1.2" in google.

iPhone simulator shows app's images but iPhone does not

I have create an application on iphone using objective-c.In this application i am just displaying different players images stored in one folder, which will be run perfectly on simulator. But when I deploy it on iphone it is not showing the images of the player.
for that the code is:
UIImageView *imageplayer = [[UIImageView alloc]initWithFrame: CGRectMake(imgx, imgy+45,135,150)];
imageplayer.image = [UIImage imageNamed:playerpng];
if(imageplayer.image == nil)
[imageplayer setImage:[UIImage imageNamed:playerjpg]];
if(imageplayer.image == nil)
[imageplayer setImage:[UIImage imageNamed:#"noimage.png"]];
[self.view addSubView:imageplayer];
Plz solve this query.
Thanks in advance
Sometimes xCode doesent update correctly the bundle, try cleaning and building again.
I am currently experiencing this problem as well. I was able to correct it after a bit of debugging and reviewing the build file.
When I do an ls -l, I noticed that some of my png files have a # symbol beside the permissions. When I followed that up with a ls -l#, it showed that the files with an '#' had an attribute set 'com.apple.quarantine'. This attribute is given to a file (often from a zip, jar, or other executable) that is downloaded from the net. You can get rid of this attribute by performing:
xattr -d com.apple.quarantine *.png
Then, select the images in XCode, and check that the checkbox under the target is checked. In my case, it was not, so the images weren't being included in the bundle.
I had the same problem, solved by using all lowercase for the file name in code - image.jpg, but it does not seem to make any difference what case the actual file name is, e.g. Image.jpg
check name of image file. It must be "noimage.png"
not Noimage.png or noimage.PNG
Just to clarify, does the "noimage.png" display, or is the program loading a player image but failing to display it? Or is nothing loading.
These should easily be determined in debug mode.
A few additional things to check...
1) Just for testing, start out with PNG versions of the player files. This is the primary format on the iPhone and might eliminate a file format issue or other anomaly that the simulator is not sensitive to.
2) With regard to fixing in an image editor, specifically make sure that the image is set to a DPI of 72 pixels/inch. The iPhone and particularly Interface Builder are very sensitive to this being correct and will sometimes not display or will display a very blurred version of the image if incorrect.
3) Make sure the image(s) haven't been added multiple times (from different directories and/or to different group folders). We encountered a situation where we had inadvertently imported the same images at two different layers within the project hierarchy and this can cause unexpected behavior within the iPhone (selecting randomly or failing to select).
4) Make sure the Get Info -> Targets has your particular target checked. The simulator may still see the image but it will not get deployed to the iPhone.
5) Make sure you can view the image within XCode and that it looks correct.
Barney
This happens to me sometimes. I once spent half a night trying to figure out what was wrong. In this end, this is what worked: open the image with an image editor and save it again. That's all. I'm using the free Acorn image editor to do this. Haven't tried it with Photoshop. (After all, it seems that Photoshop might be responsible for introducing the error in the first place, although that's far from sure.)
I don't know what causes the problem. I usually get it when I use png files that have been sent to me. Could be a simple file permissions problem, or some more subtle problem with the image format. I would be very interested in hearing the opinion of better-informed people.
In any case, if all else fails just try this: open the image with Acorn, save over the original file. Works for me.
Make sure the image files are added to your XCode project.
After some investigation, Michael's comment seems to have a solved it for me. I had all lower case as the file name but was following variable convention and had the png file with an upper case for the second part of the file name. Here my file was putback.png but was referenced in my code as putBack.png
UIImage *putBackImage = [UIImage imageNamed:#"putBack.png"]; //wrong
UIImage *putBackImage = [UIImage imageNamed:#"putback.png"]; //correct
Select correct target while adding image files to your project. Following are steps to make it further clear
Select Add Files to "YourProjectName"
In opening window there is an "Add to targets" option at bottom that shows all available targets
Check target or multiple targets in which you want to add images
Press "Add" button and you are ready to go