Skip to content
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.

More Simplification #4

Closed
wants to merge 22 commits into from
Closed

More Simplification #4

wants to merge 22 commits into from

Conversation

Hackmodford
Copy link
Contributor

I believe this is as simple as it can get. It removes the button having a textField/textView/searchBar property but I don't believe it should be the buttons job to know that. Let me know what you think.

simplified code
simplified code
made changes to work with simplified code.
made changes to work with simplified code.
added necessary code
re-added buttonTarget
remove because blocks are added
remove because blocks are added
removed toolbarButton subclass
added code to reflect block update
Simplified even further.
Simplified even further.
replaced setButtonPressedBlock to be only 1 method, and allow to specify control event. This simplifies things even further!
Simplified even further.
Updated ViewController.m to reflect simplification changes.
simplified code.
@ruddfawcett
Copy link
Owner

This is great! Can we maybe change the block name to addTarget? This way we keep the block as similar as possible to a UIButton:

[exampleButton addTarget:^{
    [_textView insertText:@"You pressed a button!"];
} forControlEvents:UIControlEventTouchUpInside];

Thanks for your contributions!

@Hackmodford
Copy link
Contributor Author

I think target would be confusing, because a target is who receives a message.
What about doing what "BlocksKit.framework" does for UIControl?

[exampleButton addEventHandler:^{
    [_textView insertText:@"You pressed a button!"];
} forControlEvents:UIControlEventTouchUpInside];

@ruddfawcett
Copy link
Owner

You're right - valid point. Event handler sounds great!

renamed setButtonPressedBlock: to addEventHandler:
renamed setButtonPressedBlock: to addEventHandler:
changed setButtonPressedBlock: to use new addEventHandler: method
@Hackmodford
Copy link
Contributor Author

I have made the changes. You're right, it makes more sense then setButtonPressedBlock :P

@ruddfawcett
Copy link
Owner

Ok, great! There are some conflicts, so I'm going to fix those. In fact, I think I'm going to delete my last 5 commits because something weird happened and they all have -m "message" for some reason... I'll then merge this.

@ruddfawcett
Copy link
Owner

@Hackmodford can you squash this into one commit? By squashing your other commit, I think I messed up this Pull Request... If squashing this doesn't work, maybe open up another pR? Thanks - appreciate your work on this repo.

@Hackmodford
Copy link
Contributor Author

I will create a new pull request

@Hackmodford Hackmodford closed this Jan 7, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants