We can work in an orthonormal basis in which $A$ is diagonal. In that case the diagonal entries of $AB$ are $a_{ii}b_{ii}$, so $$ tr(AB) =\sum a_{ii}b_{ii} \leq \sum a_{ii}|b_{ii}| \leq \sum a_{ii} \|B\|=tr(A)\|B\|. $$$$ tr(AB) \leq|tr(AB)|=\left|\sum a_{ii}b_{ii}\right| \leq \sum a_{ii}|b_{ii}| \leq \sum a_{ii} \|B\|=tr(A)\|B\|. $$