Mobile edge computing (MEC) provides computational services at the edge of networks by offloading tasks from user equipments (UEs). This letter employs an unmanned aerial vehicle (UAV) as the edge computing server to execute offloaded tasks from the ground UEs. We jointly optimize user association, UAV trajectory, and uploading power of each UE to maximize sum bits offloaded from all UEs to the UAV, subject to energy constraint of the UAV and quality of service (QoS) of each UE. To address the non-convex optimization problem, we first decompose it into three subproblems that are solved with integer programming and successive convex optimization methods respectively. Then, we tackle the overall problem by the multi-variable iterative optimization algorithm. Simulations show that the proposed algorithm can achieve a better performance than other baseline schemes.