how to draw hexagonal image in a UICollectionView - ios

I have created a dynamic page in order to show profiles of the user. For that i have used collection view cell, what i want is that i have to represent those profiles in a numeric manner and that too inside a hexagon shaped image. Kindly can anyone give me some ideas how to do it. Am pretty much confused. Here is the screenshot of how the dynamic page should look like.

Solution is very simple. Just use UIImageView with hexagonal image.jpg just like shown in above cells, and show UILabel over UIImaeView, which shows Number in white font.

Related

Resizable and Rearrangable CollectionView Cell with Image: Swift or Obj-C

My CollectionView Cell has only Image in it. I want to resize that
image by user, and while resizing the image all the cell should
automatically rearrange (I have fixed image count i. e. 22):
I have used flow layout for
collection view but limitation is that needs fixed number of
height/width.
I have added resized library separately.
I Tried by searching many libraries and doing so many demos but not
able to get the required output. I want you to suggest me either the
way should i go with or If you have done such kind of stuff then your
thought are welcome.
Thank you in advance.

Best way to create a bar graph with UIImageView?

I have a UITableView with several sections. In each section are rows with various items. I have a custom UITableViewHeaderFooterView for each section and I would like to set the background image for each one to illustrate a particular percentage associated with each section.
I was thinking I could have a simple image with a line and two colors on either side and somehow scale/translate this image so that the line and bar color would fill up the table header from left to right in accord with the percentage value for that section. This changes so I would need to be able to re-draw it whenever the values change.
I figured that if the image did not scale to fit, but rather the left and right edges were set to bleed instead of tile, then I could just reposition the image in the view. But I'm not quite sure how to go about that, or even if that's a reasonable thing to do. Just looking for advice on a good approach for this sort of effect.
You can add image to the image view and can show the percentage of the image to the image view as per the percentage you get in that particular sections.Fill your image view with full image and display the percentage accordingly.
Instead of using an image, create a custom UIView subclass. Give it a property or two to represent the data. Then implement the drawRect: method to draw the graph.
Use this custom view in the table header/footer view instead of an image.
This has the advantage of being more flexible. If you want the graph to be fancier or different, just update the drawRect: method as needed.

How to clip image to UIView animating over it?

I've been looking around here and seeing lots of questions that seem related, but I haven't found anything that's exactly what I need.
I have three UIViews that are animating inside a custom viewController. I want there to be a static background inside the viewController that is only revealed within the clipping bounds of the UIViews.
It's kind of like spotlights on a prison yard: the background should stay in one place, but as the spotlights move you can see different parts of it. Except that I don't need circles, regular old UIView frames are fine.
For instance, it seems like what I need is in the answer to this question: How to achieve dynamic UIView masking?
...the answerer provides a link to a page that shows how to statically mask an image, and then the answerer says "But personally I think i would make 2 UIImage views and crop the content of the draggable UIView"--without any info on how to do that.
How do you do that?

iOS UITableView cell layout questions

I have a chat on a web site that looks like this.
I am now building an iPhone app for this and have some problems creating the same layout. I hope you can point me in the right direction. Is subviews or webviews the best choice?
If using UIView, UILabel and UIImage, what is the best way to make rounded corners and the little arrow. The gradient background should not scroll with the table view. What's the easiest way to calculate the hight of each message? What is the best way to async load the images over http?
If using a webview, what is the best way to populate it with data? Building string? Having a template and populate the image, username, time and message thru JavaScript? How can I resize the UITableCell and UIWebView to fit the contests?
Will a table full of UIWebView be much slower than using labels? Will I need to create it twice to return the height of the cell in heightForCellAtIndexPath and add it in cellForRowAtIndexPath?
Thanks for your help!
If you wish to see it live, visit www.aktieguiden.com
This is really a lot more than two questions, and I'll answer several of them.
I would use a table view with a resizable UIImage and a UITextView for each bubble. Use an image of the bubble in png with a transparent background, and make it resizable. Import it with UIImage's -(UIImage*)resizableImageWithCapInsets:(UIEdgeInsets)capInsets. To determine a height, UITextView has a contentSize property which will tell you the size of the view that can be scrolled. For asynchronous loading, use one of the many tutorials or frameworks for that purpose. Here is one:
http://developers.enormego.com/view/what_if_images_on_the_iphone_were_as_easy_as_html

Fill Color Selected Area in UIView upper Layer

I am trying to develop paint type App for iPhone/iPad. I have done 70% but one functionality is taking time to complete it. I have added To Fill Selected Area with Selected Color functionality inside it. I did it but it is taking to much time or working too slow. Due to this functionality, whole App become freeze.
Structure of Drawing View :-
UIView(Parent View)
-UIImageView(SubView1)-To keep image as a background
-UIImageView(SubView2)-To draw color or draw line
In above structure, Parent view is work as a Canvas View and Subview1 is lowerview and Subview2 is upperview.
My approach :-
1)finding currnet point.
2)getting pixtel color.
3)get screen shot for whole screen.
4)get array for those pixtel who have a same pixtel color as select pixtel in current screen shot
5)now we use 4Q pixtel fill color for identifying pixtel who is connected with selected pixtel and making array for all those pixtel.
6)After getting the final array for the pixtel, we draw a pixtel with selected color.
Any one help.
I need a another implementation for Flood fill with a more smooth way functionality.
Pls provide me a Code sample.
Thanks in Advance.
Use a stack based flood fill: http://www.drowningintechnicaldebt.com/ShawnWeisfeld/archive/2006/12/04/stack-based-flood-fill-algorithm.aspx
I found this and it worked a treat for me!
https://github.com/Chintan-Dave/UIImageScanlineFloodfill
Very easy to implement too.

Resources