所需知识
一、Masonry
二、MVC设计模式
三、中缀转后缀
四、四则运算(加括号)
基本思路
首先在M、V和C的相关内容,然后通过点击按钮并向字符串中添加对应的字符,然后在M中对字符串进行相关数据处理。
按钮布局处理
使用Masony:
_buttonArray = [[NSArray alloc] initWithObjects:_buttonDelete, _buttonLeft, _buttonRight, _buttonDivide, _buttonSeven, _buttonEight, _buttonNine, _buttonMultiply, _buttonFour, _buttonFive, _buttonSix, _buttonSubtract, _buttonOne, _buttonTwo, _buttonThree, _buttonAdd, _buttonZero, _buttonPoint, _buttonEqual,nil];
_contentArray = [[NSArray alloc] initWithObjects:@"AC", @"(", @")", @"/", @"7", @"8", @"9", @"*", @"4", @"5", @"6", @"-", @"1", @"2", @"3", @"+", @"0", @".", @"=", nil];
for (int i = 0; i < 5; i++) {
if (i < 4) {
for (int j = 0; j