当应用程序加载时我必须选择选项但我想显示应用程序加载时选择的默认单选按钮.. 我已经使用此代码显示单选按钮
public func createRadioButton(frame : CGRect, title : String, color : UIColor) -> DLRadioButton {
radioButton = DLRadioButton(frame: frame);
radioButton.titleLabel!.font = UIFont.systemFont(ofSize: 14);
radioButton.setTitle(title, for: []);
radioButton.setTitleColor(color, for: []);
radioButton.iconColor = color;
radioButton.indicatorColor = color;
radioButton.contentHorizontalAlignment = UIControlContentHorizontalAlignment.left;
radioButton.addTarget(self, action: #selector(ViewController.logSelectedButton), for: UIControlEvents.touchUpInside);
self.view.addSubview(radioButton);
return radioButton;
}
@objc @IBAction public func logSelectedBtn(radioButton : DLRadioButton) {
if (radioButton.isMultipleSelectionEnabled) {
for button in radioButton.selectedButtons() {
print(String(format: "%@ is selected.\n", button.titleLabel!.text!));
}
} else {
hello2 = radioButton.selected()!.titleLabel!.text!
print(String(format: "%@ is selected.\n", hello2));
}
}
答案 0 :(得分:0)
使用此代码:
require_once 'Zend/Search/Lucene/Analysis/Analyzer.php';
{
private $_filters = array();
public function addFilter(Zend_Search_Lucene_Analysis_TokenFilter $filter)
{
$this->_filters[] = $filter;
}
/**
* Apply filters to the token. Can return null when the token was removed.
*
* @param Zend_Search_Lucene_Analysis_Token $token
* @return Zend_Search_Lucene_Analysis_Token
*/
public function normalize(Zend_Search_Lucene_Analysis_Token $token)
{
foreach ($this->_filters as $filter) {
$token = $filter->normalize($token);
// resulting token can be null if the filter removes it
if ($token === null) {
return null;
}
}
return $token;
}
}
答案 1 :(得分:0)