I have a UIView and I want to change background color for half the screen to gray and other half to be blue.
Is there a way to do this? I am using RMQ for but I'm not tied to it as long as I can get it done.
Should I create two different UIView's and put them next to each other?
This is something like what I'm after
I tried the following but it didn't work.
m = CGRectMake(10, 10, 100, 100)
self.view.addSubview(m)
If it should be one view, you can use a background image and call it a day: in your style:
st.background_image = image.resource('your_image')
You can also draw on your layer to add the two colors. I won't describe that because I doubt that is what you'll need. CGContextFillRect for your research.
You can make those two different views, assuming they are grouping something logical. But if not, you can add subviews purely for the coloring too:
rmq(self).append(UIView, :top_style).back.append(UIView, :bottom_style)
Then set the styles in your stylesheet:
def top_style(st)
st.frame = {w: screen_width, h: screen_height / 2}
st.background_color = color.gray
end
def bottom_style(st)
st.frame = {t: screen_height / 2, w: screen_width, h: screen_height / 2}
st.background_color = color.blue
end