I'm new to iOS dev and need a UICollectionView to display all images in async within a folder on my webserver.
Let's say the folder is: www.website1.com/img/new/
I will have a JSON file that shows text and an image pertaining to that text. Something really basic like:
{"Items":[
{"URL":"URL.com/img1.jpg", "TEXT":"TEXT1"},
{"URL":"URL.com/img2.jpg", "TEXT":"TEXT2"},
{"URL":"URL.com/img3.jpg", "TEXT":"TEXT3"}]}
The code simply needs to parse the JSON and update accordingly. What would be the simplest way to achieve this?
Create object form your flux Json
Create and fill data source of your collection , this data source contain all objects
Custom your UICollectionViewCell (imageView)
Manage downloading image since CellView (use cache)
See this article for asynchrone download https://www.appcoda.com/ios-concurrency
hope it help.
Related
Trying to stretch my understanding of how mapdeck can plot maps and the new (new to me) Ordnance Survey Vector Tile API that can display 3D buildings
See
https://labs.os.uk/public/os-data-hub-examples/os-vector-tile-api/vts-example-3d-buildings
Has anyone any advice about how to reference the labs.os.uk data as a layer in mapdeck?
I suspect it is not possible to set a transformRequest function when using Mapbox via Mapdeck.
But you can probably do it by downloading the tile json from https://api.os.uk/maps/vector/v1/vts&key=your_os_api_key&srs=3857
Edit by appending &srs=3857 to the "tiles" url.
Save the edited tile json to your server.
Then download a copy of the 3d style json from https://github.com/OrdnanceSurvey/OS-Vector-Tile-API-Stylesheets/blob/master/OS_VTS_3857_3D.json
Edit by appending &key=your_os_api_key to the "sprite" and "glyphs" urls, and edit the "sources" "url" entry to point the tile json on your server.
Save the edited style json to your server.
Hopefully Mapdeck can then be used with style = parameter set to the url of the style json on your server.
having trouble with Logic App usage, so i am receiving a file with example text below and need to map them according to their tags. so for each tag they will go to different fields in my database. Keep in mind I cannot change the structure of the file, stays as is due to previous systems:
:2e:hello
:3t:there
:fy:people
What I do is pull the file from file storage and them i can access the content which are the values above. But what I need to do is check if i have ':2e:' and if so take its value which is 'there'.
Any suggestions?
thanks
How would I go about creating a multiple page pdf from a scrolling view? I am trying to convert an invoice pdf and it is much longer than 1 page; not sure how to create more.
also while on this, the pdf also seems to be quite choppy in quality ( very rasterized ) - any tips to improve this? i realize it's not vectorized, hence the choppy look, just looking for a way to make it better? thanks
To create multiple pdf, after creating each page you can convert the entire page to an image an store it in an array, one by one. Then you can show each image from the array as scrollview if thats what you meant.
You can create pdf pages and write it to a file with following function. Call it for each page.
-(void)savePDFImageToDocumentDirectory:(UIImage *)pdfImage withPageNumber:(int )pageNumber{
NSString *tmpPngPath = PDFTempDirectoryPath;
NSString *pageName = [NSString stringWithFormat:#"PDFPage%d.png",pageNumber];
NSString *imagePath = [tmpPngPath stringByAppendingPathComponent:pageName];
[UIImagePNGRepresentation(pdfImage) writeToFile:imagePath atomically:YES];
}
You can follow two approaches tom create pdf. One through html method and the other is from xib files. Html method is fast but pdf will be of less quality. xib method gives you high quality pdf but uses a lot of memory.
If you are happy for the PDF generation to be remote you could use a service like Docmosis cloud services or Aspose to create the Document and stream it back to the device (or email it or both etc).
Typically these PDF tools wouldn't build documents from images like screen shots - you would send the data you want populated instead. This means the quality is very good (and text is selectable etc) and multiple pages is expected making the PDFs more generally useful.
Please note I work for the company that created Docmosis.
Hope that helps.
Given :
view A ( uitableView ) is used to display all images after you successfully pull them from a server via a request named getAllImages
you can also upload a new photo in view A via a top right button
My Goal :
Display a new set of images ( the new images included) on the table
What I am doing is :
send the request to server for uploading image ( i am using afnetworking to do that)
since server side is only returned "success" or failure" to me without other information. Supposed it is success, I will fire a request to get the new set of images via getAllImages
will invoke reloadData to display a new set of data on the table
I am not sure this is a good way to do it, I am still looking for the best approach to achieve this task. I dont know should I use core data in this task and how to use it.
Please give me any suggestions if you have been experiencing this task. Any comments are appreciated.
Here is what I would do:
1 - call getAllImages to show all N images
2 - take new photo
3 - display N images previously gotten from getAllImages, and 1 local image from step 2
4 - fire asynchronous request (do not specifically remember how do we do that using AFNetworking) to upload image from step 2
5 - if success code, keep N+1 images. If failure code, show only N images and remove the last one.
You can specifically reload only single row using reloadrowatindexpath, without much of a performance hit.
What I did on iOS is displaying grid of 10 images. For this I take a array and add all images to array. For this I am write the code as:
[_image addImage:[UIImage ImageNamed:#"black.jpg"]];
like this I add all images to array. Now what I need is to get all the images through Xml file and add to the images array. How can I do this?
The class you need is NSXMLParser and the delegate NSXMLParserDelegate.
Have a look here or even here at SO. What you are looking for is to parse an XML document, and you can do it with the NSXMLParser class, libxml2, or other libs/tools mainly based on those two. Also you'd better have a look at this project by Apple it will show you the main differences in terms of performance between technologies
First of all you need to parse your xml file. You can use the NSXMLParser class. How exactly you would do this, depends on the structure of your xml file. There are a lot of tutorials on the Internet about how to use it, for example see here.