By the way, but I think I am doing the wrong thing in the original refactoring.
Therefore, I have a 3 UIView
element which I am constantly using again:
- Label
- Input
- Check Mark
There is some recognition and other reasoning that I also want to refactor (as with the new class as well as the argument also reuse has been done).
So, do I want to start with a UIViewController
sub class and add everywhere I use these elements or UIView
?
I do not think how validation code should be needed by UIVew
. So, I'll need the UIViewController
but it does not matter to me because you do not have UIView
objects in your views, not UIVIewController
objects
thoughts?
Edit:
- What are the assumptions?
- Basically there is a label, input and check box.
- When the user enters the text, the label changes color and changes the check mark on the basis of verification (I was actually going to do the verification rep)
- If all is done well, then the check mark is green & amp; The label changes color again
I touched it on it
There is very little information to provide detailed information in your question but you can do it in many ways.
You must create a UIView
subclass and add Subvues
for label, input and check mark and to provide them as property so that you To do something like this ...
myReusableView.label.text = @ "Hello World";
or
[myReusableView.input becoming First Responder];
Then you have to add these subviews in fact. It can be done in code ...
- (instancetype) initWithFrame: (CGRect) frame {... self.label = [UILabel new]; Self.label.frame = // blah [self-add Subview: self.label]; ...}
Or you can do it in a settlement and add outlet and more ...
There is nothing wrong in applying some assumptions in it. Is there you are present This is a very long time, for example, if you try to set the progress value value for more than 1, then it will be captured and set to 1.
It also depends on what type of verification you are doing, you can always put it in a view controller and use it as a child's visual controller. (I personally do not do this though)
You can provide representative methods to "outsource" verification to elsewhere. / P>
What validation are you doing?
No comments:
Post a Comment