简体   繁体   中英

ReactiveCocoa apply same properties on multiple objects

I don't know if ReactiveCocoa can do that, or if it's one of the right use case for it, basically I want to setups 2 or more views the exact same ways, for instance

[self.photoOrVideoLabel setTextColor:[UIColor glInboxGrayTextColor]];
[self.photoOrVideoLabel setFont:[UIFont glProximaNovaRegularWithSize:12.0f]];

[self.writeSomethingLabel setTextColor:[UIColor glInboxGrayTextColor]];
[self.writeSomethingLabel setFont:[UIFont gLBaskervilRegularWithSize:12.0f]];

Is there a way with reactiveCocoa to merge them and configure them in the same block ?

This isn't a ReactiveCocoa problem. Just factor out the common code ( -setTextColor: and -setFont: ) into a reusable method or block and invoke that twice.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM