Progress Bar with partial, unsequential areas of fill - iOS - iphone

I need to make a kind of progress bar for the reading levels of a book.
When the user reads the certain pages of the book, the progress bar should show the visual progress that highlights only specific area of the progress bar for the pages that have been read.
For example, if the total number of pages for a book is 100 and user has read the page 1 to 10 and 90 to 100, the bar should show the 10% highlight on the extreme left and 10% highlight on the extreme right. This way, the progress bar will show different areas in it that have been read.
I can't seem to find the native methods in the UIProgress bar that supports this. Is there anyway this can be done?

for that you have to create custom progressbar you can use core graphics and and fill area of uiview corresponding to progress
divide total number of pages by width of uiview and use that.
use that link for know about core graphics Core Graphics Draw lines , rectangles

Related

Top and Bottom image is cropped in a bubble chart

I am using tableau for visualization. In one of my dashboard, i am creating a bubble chart for displaying no of population growth on Y-o-Y, based on the data from the extracts.
This dashboard shows different bubbles calculated based on each year. On clicking each bubble, it will display the additional data information inside the bubble for the year. The other bubbles in the dashboard will be grayed-out.
Everything is working good. But i could see that, when i click one bubble, the top and bottom position in bubble is getting cropped off. The other bubbles are getting grayed-off as normal.
Note: I need to display 4 dashboards in one visualization as per guidelines. Maybe the height and width used for dashboards could be an issue.
All i want to know is, whether this is default behavior since tableau takes height and width automatically in my visualizations?
Thanks,

Swift iOS UI Advice

I am looking for some general advice and maybe some example code of what I am trying to accomplish if anyone knows of any for an iOS swift project. I would like to either:
A) Make the background, of the blue view, gray and only show a certain percent of the blue area.
OR
B) Overlay the gray area on top of the blue view and just keep making gray area bigger.
What I am trying to do is simulate battery power and show a battery.
I've considered using a progress bar and doing option A, but the blue area is NOT a solid color. Its actually an image. I've tried using an image for the progress bar, but the image needs to keep its dimensions. (Ex: If progress shows 20% it needs to show only 20% of the image or "blue area", but if you use an image as the progress bar it just shrinks the image and still shows 100% of it instead of just the 20% I need to show).
You can easily write a custom self-drawing UIView that will behave in exactly the way you describe. In other words, you tell your UIView a percentage, and it redraws itself with the blue on the left and the gray on the right. You can even draw the darker gray stroke outline shown in your drawings. All easily accomplished in code.
I like being able to lay things out visually and take advantage of autolayout. Here's how I would do this (in a nib/storyboard):
Place a UIView on your canvas and give it the gray background. Give it whatever autolayout constraints are appropriate for you.
Place a UIView inside the one from #1 and give it the blue background. Anchor it's left, top, and bottom to the gray parent view and give it whatever width (doesn't matter).
Add an outlet to that width constraint you made in #2.
Now all you have to do is modify the "constant" property of that width constraint to give you the desired "progress". So if your gray view is 100 wide and you want to present "20%" progress, then just do "yourWidthConstraint.constant = 20".

Show a chart with very high and very low values

I have a bar chart that shows sales against targets for categories as percentages of the targets.
The problem I have is that sometimes one or two of the categories will overperform making the chart hard to read.
Capping the Y axis at 200% has been deemed unacceptable as the usres want to see the top of the bar.
The users have asked if it is possible to crop a section out of the middle, so you would see 0% - 150%, then a gap then (top of high bar - 10%)% to (top of high bar + 10%)%. I dont think this can be done using the built in chart control.
Does anyone have any ideas of a good way to handle this situation?
Check out scale breaks:
http://technet.microsoft.com/en-us/library/bb934379(v=sql.100).aspx
No guarantee it will work as hoped with your data, but a good place to start.

How to center a UIActivityIndicatorView along with text (UILabel)?

I've had this issue come up a couple times doing iPhone development now and have yet to find a good solution for it. What I'm looking for is this:
I want to show some text along with an icon and I want the overall display to be centered within its parent view. Specifically, in my current case, I'm looking to display a box that says "Reconnecting..." with a UIActivityIndicatorView to the left of the text.
Previously, I've just relied on the fact that I know exactly the dimensions of the text and activity indicator, so I can position things absolutely to appear centered. What I'm looking for is something more automatic.
Any ideas?
One of the UIKit additions to NSString will return the pixel size of the text if you give it the font that you're using on the UILabel. So then presumably the total size of the two things together in the layout you describe is:
the difference between label.frame.origin.x and activityIndicatorView.frame.origin.x; plus
the width of the text.
You can then either shuffle both the views appropriately or give them a common parent that's still a subview of the whole thing and shift that.
An activity indicator can be shown in a view just calling a single method.Please click here get SHKActivityIndicator class

Progress bar on iPhone using UIImages

I'm designing a progress bar for an app that essentially is two UIImages - both are the exact same size (long rectangles with rounded corners), except they are colored differently.
The bottom bar is black and the progress bar that will fill over it is grey. Displaying the bottom bar is easy enough. The issue I'm trying to figure out is how to get the grey bar to display only a piece of itself.
For example....
grey : <-------
white: <------------------->
Essentially, I'd like to display only the first half of the grey bar because my progress is at 50%. I'd like to keep the rounded corners at the left of the image though.
Is it possible to dynamically crop UIImages?
The easiest way to do that is to create using 3 separated images: 2 with rounded corners (left and right), and one small easily resizable image to display progress.
And yes, you can crop images dynamically, but not as easy and as quick as need for progress bar.