Custom UiTableView from array data - ios

I have a custom table view and want it to look like this...
(source: pulsewraps.co.uk)
The image is loaded via async and the two lines come from two different arrays. I can get all the data in fine I just don't know how to lay it out.
I want:
the black gradient to overlay the image
the two lines of text to be within the black gradient box
the image to fill the table row to cover it and keep it's aspect ratio
the black gradient box to be pinned/constrained to the bottom of the image so that is either line of text is larger than two lines it covers more of the image and doesn't drop below it.
I fill the table data in a loop according to the number of records in my array which is populated by json.
I have managed to do the layout in android but can't get my head around ios.
Any help much appreciated.

If you're using autolayout, you'll want to constrain the labels to the bottom and to each other. Then put the gradient view behind the labels and constrain the top of the gradient to the top of the top label.
You'll have to handle drawing the gradient yourself, either use an image in an image view and set it to scale to fill, or subclass UIView and add a little bit of code to drawRect: The first is probably easier, the second will produce a more uniform gradient if it has to be scaled.

Related

iOS Core Plot X Axis text + icon

Hope you people doing great.I am new to Core Plot api and need your suggestion.I want to customize x index of plot and wants to add icon and label to each index.As I have searched , I got to make policy none to index but I want to add image to each label.Help will be much appreciated.
Custom axis labels don't have to be just text. The label's contentLayer can be any CPTLayer. Depending on what you're trying to achieve, you could render your text and label into an image and use that as the fill for a CPTBorderedLayer, add the icon (in a bordered layer) as a sublayer to the text layer for the label, or even create a custom CPTLayer subclass that draws everything the way you want it.

Is it possible to position a text label in a layer?

I add a sublayer to create pie charts in my swift code. To optimize the view for different devices, I would like to position the text labels which I put on the view in the storyboard in relation to this layer ("build a group").
Is it possible to position labels in a layer? How can I do that?
Sure it's possible. You can create CATextLayer objects and add them as sublayers of your pie chart view's layer.
If you mean is it possible to put UILabel objects inside your layers, then the answer is no. Views can contain layers, but layers can't contain views.

Cropping sharp edges from behind a UIBezierPath rounded rectangle

I'm learning my way through UIBezierPaths by creating a table from scratch, and having individual cells filled with different colours.
This is a custom object I'm building which is contained in a subclassed UIView.
At the moment, I'm constructing this in this order:
'Cell' fill colours
Column lines
Row lines
Outer box (rounded rect)
As the picture suggests, I'm having trouble getting rid of the sharp corner of the cell fill outside the orange rounded rectangle.
Can anyone point me in the right direction to get rid of these?
Cheers! :)
At the beginning of your drawing code you should add the outer rounded rect path to the clipping path using its addClip method. That way nothing will get drawn that is outside this path.

iOS gradient transpareny mask over animated view

Hello,
Looking for insight from the gurus.
I need a stack of 3 views:
A: View containing various buttons, text inputs.
B: Custom view containing a large view (B2) that moves and rotates and contains multiple subviews and another fixed view (B1) that has a custom gradient transparency mask.
C: Image view containing a background image
I can't figure out how to get the B1 layer working. I can make the gradient but am unsure on how to apply the mask so it only affects the transparency of the subviews of B2. I need the background (C) to show through all the way to the top view (A). Was thinking of using a mask directly on B2, but can't since it is moving around. Confused.
Any advice?
Have you tried using the mask layer of the B's layer? Try to set it to B1 (not as a subview/sublayer) and update its position as necessary when moving B2.

WP7.5 Mango Tile BackContent alignment

Is it possible to center-align the BackContent of a tile?
For example:
54"
2-2
I want the above two lines aligned centered on the back side of a tile. Is this possible?
Sample: http://www.silverlightshow.net/Storage/Users/AndreaBoschin/__Capture.png
You have to draw the text manually onto your BackBackgroundImage as you cannot adjust the placement of the BackContent.
It is not possible to update your Tile with animations or sound. The
placement of the Tile properties is not customizable.
MSDN Source
Edit: Have a look at this question, there is example code showing how to do it.
Draw a image, where it's aligned, and use that as a back property. I've written a guide about it.
(For the front tile, but the backtile is no different).

Resources