Subclassing UITableView to overlay a rectangle on the table frame - ios

Aim: To draw a tableview with a rectangle at the bottom (frame bottom and not the scroll bottom). I plan to use some blend mode for the rectangle. The resultant effect would be of the last row sliding from under the rectangle.
What I Have Done: Tried subclassing UITableView and drawing a rectangle in its drawRect(). But this draws a rectangle either above or below the table and not over it.
Update: Tried subclassing a UIView and drawing the table and rectangle inside it. But the table hides the rectangle and I have to set the table background to clear for the rectangle to be visible.
Please help.

Related

Partially show imageview

I am trying to create an animation where an image view is moving up and down vertically. I have a line that the imageview is passing through, and my intention is to have the imageview hide partially when passing through the line. For example, if the line is halfway between the imageview, then the bottom half of the imageview should be hidden. Therefore, it would be ideal if there was a library of function that could hide a fraction of the imageview based on a specified y position. Please find examples of what I mean in the attached screenshots.
In this screenshot, the part of the circle (imageview) underneath the line should be hidden, but the top half should be shown.
Also, keep in mind that the background is a changing gradient so I wouldn't be able to use a rectangular view with the same background color to hide the circle.

Can we hide a UIView partially in iOS

I have to partially hide a UIView when user scrolls over it. There is a UIScrollView above UIView.
For example in the given image below i want to hide the area covered under the scrollable area which is in blue color. All my views background colors are clear color.
I want to hide the part as given in the below image, the marked rectangle which is in red color. So that part of text (One, Two, Three) is only visible.
Each UIView, including UIScrollView, has a Core Animation Layer (a CALayer).
You access the CALayer with
view.layer
In turn, a CALayer has a mask, which you access with
layer.mask
Using the mask is the most comprehensive method of controlling visibility and opacity at runtime.

Setting Animation behaviour for UIImageView

I have an image view which is a circle with the upper half in black and the lower half as white with another black circle at the center.
If I swipe up then the white color should increase from both the ends simultaneously... I have added a UISwipeGestureRecognizer and gestures are detected
How to increase the color from the lower half using animation?
Is there a way where I can set alpha value while swiping up, using animation?
Several things:
A swipe gesture is a one-shot. It fires once, and doesn't give you a chance to animate as the user drags. You want a pan gesture recognizer for that.
There is no off-the-shelf animation that will animate color changes to different parts of the image as you describe. You'll have to create your own. Your description is kind of vague, so it's a bit hard to give you suggestions. Do you want to replace the previous contents of your image view with pure white, coming from the top and bottom, or do you want to brighten your original image view towards white? You need to describe the effect you're after in a lot more detail. You could probably get the effect you are after using Core Animation and either a CAGradientLayer or a CAShapeLayer. A gradient layer could act as either an overlay that would cover the image view underneath, or as a mask that would reveal a new image on top in the final state you're after.
As to your question #2, animating the alpha is trivial. Again, you need to use a pan gesture recognizer, not a swipe gesture recognizer. Then you could adjust the alpha value of the view as the pan position moves up the view. You could also trigger a crossfade style animation with a swipe gesture, and use UIView animation methods like animateWithDuration:animations:

mysterious white antialiasing behind UIImageView

I'm using a PageViewController to swipe through a series of daily ViewControllers for a week.
The UIViewController that contains the pageViewController contains a few navigation items that do not scroll with the pageViewController. These stay stationary as you swipe. One of these items is a UIImageView, more specifically a UIButton with an UIImageView image representation.
The trouble I'm having is that this stationary UIImageView has a thin white border to it when it should not. I'm giving it a rounded appearance by using rounded corners that are the size of the image. It is easiest seen in this photo. Note, the white "halo" is not part of the image, it appears for any image. The borderColor, imageBackground, view background, and parent view backgrounds are all clearColor. The red background below is part of the swipeable viewController. Interestingly, the white border only appears when it is stationary. If the image/button is placed in the swipeable View it looks great.
Any thoughts how I can get rid of this white antialiasing?
I changed the button's image from using the backgroundImage to just the image property and the white went away entirely. Glad for an easy fix, hope this helps someone else.

IOS - How to draw a border and a shadow that rotates with view but doesn't scale with it

I am developing an ios app.
In my app I have got a view, the view is has got a border and a shadow.
The view can be scaled and rotated.
When a user scaled my view it causes my border and shadow to scale as well.
I don't want my shadow or border to scale at all.
On the other hand I do want my shadow and border to rotate when I rotate the view.
Is there any built in mechanism to prevent border \ shadow scale?
Thank you
As far as I know there isn't such a built in mechanism.
The only way I see for you to solve your problem is to simply use two different views, with different management in case of rotation.
Have one view as a sort of background and add your border and shadow to it, and then place the content on top of it (or in it, depends on your case).

Resources