IPhone user control using a subclass of UIViewController

I need a control like UISlider, but with two thumbs instead of one so you can specify a range, not just a single value. I read about other people who were looking for the same thing, and suggestions for creating new controls were above my head.

So, I decided to configure what I wanted in nib, and then created a view controller to handle its behavior. This actually works really well, so take it for 2 things.

1) To load my “custom control” into a different tip, I need to do this with code like this ...

MaxMinSliderViewController *feeMaxMinSlider = 
    [[MaxMinSliderViewController alloc] init];
[self.view addSubview:feeMaxMinSlider.view];
feeMaxMinSlider.view.frame = CGRectMake(20, 20, 280, 54);

... instead of dragging and dropping into other pens, such as regular IB controls. Is there an easy way to do this?

2) In all of my reading on how to do this, it seems that I had (to do it right) a subclass of UIView, not a UIViewController. I could not configure UIView correctly and make it work.

Thoughts?

+3
source share
3 answers

instead of dragging and dropping it to other pens such as regular IB controls. Is there an easy way to do this?

Nope! There is an incredibly difficult way !

+3
source

, UIView, UIViewController, Interface Builder ( , ).

Interface Builder UIView / .

, UIView, "" "" ( (i) ) UIView . , NIB, UIView.

IBOutlet .. .

.. , , UIButton , Builder.

, , , , = CGRectMake (20, 20, 280, 54) .. .

+2

Interface Builder, Mac OS X, iPhone.

, XCode 3.2.1 Mac OS X IB; iPhone (Cocoa Touch). , iPhone.

0
source

Source: https://habr.com/ru/post/1717251/


All Articles