Replicating CATextLayer with different string - ios

I am creating gridlines using CAReplicatorLayer. To each gridline, I also want to add a CATextLayer that shows the corresponding numerical value. I do not want to do this manually, however with CAReplicatorLayer there doesn't seem to be a way to dynamically change the string property of each text layer, and they all show the same initial value that is set.
Is there a way around this or do I have to create and maintain the text layer objects manually?

Alright, so I ended up creating an array of CATextLayers and maintaining it manually alongside the gridlines created by the CAReplicatorLayer.

Related

How can I get the CIAttributedTextGenerator filter to break onto multiple lines?

I'm working on an app that overlays text onto an image. We want to be able to constrain the width of the text and have it break onto multiple lines, much in the same way that UILabel does when we set numberOfLines = 0. In my mind, this should be possible by constraining the extent that the filter has to work within somehow, or by chaining it with a clamp (since the output bitmap is generated lazily.) Unfortunately, nothing I've run into seems to do the trick:
The CIClamp approach generates a nil outputImage when provided a CIVector(cgRect:) argument
There doesn't seem to be a way to specify a CIFilterShape to draw the text within when using the bundled filters
You can provide a CIFilterShape when invoking CIKernel.apply but a) I don't have a custom CIKernel (and am hoping not to write one) and b) I don't have a way to extract the kernel from the CIAttributedTextGenerator filter
I'm resigning myself to manually computing line breaks but it really seems like Core Image ought to be able to handle this use case. Am I just missing something?

Can we add multiple values on balloon marker with image in ios-charts?

I am using ios-charts and i added one value to balloon marker,
now i wish to add two values in two line in balloon marker and also wants to add two dots before that two values, i have implemented it in objective c.
I want to change balloon marker font color as well
So is it possible to implement in iOS charts ?
I would say it's definitely possible, but how easily you can do it is what you need to think about.
Balloon marker is just a example of how to use ChartMakrer. You can of course sub class ChartMarker and make your own.
I would consider render all your values and dots into one image, and assign it to ChartMarker's image property.

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.

Reusing CCLabelTTF

I want to use the very same label in all my CCMenuItems. If I create the same CCLabelTTF once, then I can't add it to more than one CCMenuItem because it will give runtime error about label already added. But creating the same label many times also not effective, if the label is same. How to optimally solve this problem?
you cannot use the same label more than once, the label is not only what you see, for example it also contain a position, so you cannot place the same item in 2 different points.
What's the problem on creating more than one? if you have a LOT of ttf labels that change text often you can consider using bitmap fonts. they are rendered faster

Getting Polygons to display multiple variables using a stripped color scheme in ArcMap

I am creating a map in which i want a polygon to display two separate variables within it. Therefore I want a stripped polygon relating to both the keys from the separate factors however I have no idea on how to do this. I messed around with multiple attributes on the properties section and could get the two variables up however could see no way of making the polygon display them both.
Thank you, any help would be appreciated
This is partially manual, but you are going to have to make a separate category within one of the fields that identifies the multivariate features. You could also create a new layer that is a selection of these features. Once you have that, go to the layer properties and display the features as 'Categories - Unique values, many fields' and hit the 'Add All Values' button. Once the categories are populated select the one you are interested in and pick a hatched symbol such as 'Radiation Overlay'. Then go to the Symbol Property Editor (double-click the symbol) and modify the two layers that make up the hatched symbol. You need to adjust the color, line thickness, offset, etc. until you get it to look the way you want. Probably not as auto as you wanted, but it will satisfy display purposes.

Resources