In this work, we study the joint optimization of multiple unmanned aerial vehicles (UAVs)' trajectories, power allocation, user-UAV association, and user pairing for UAVassisted wireless networks employing the nonorthogonal multiple access (NOMA) for uplink communications. The design aims to minimize the total energy consumption of ground users while guaranteeing to successfully transmit their required amount of data to the UAV-mounted base stations. The underlying problem is a mixed-integer nonlinear program (MINLP), which is difficult to solve optimally. To tackle this problem, we derive the optimal power allocation as a function of other variables, which is used to transform the optimization problem into an equivalent form. We then propose an iterative algorithm to solve the resulting optimization problem by using the block coordinate descent (BCD) method where three subproblems are solved in each iteration and this process is repeated until convergence. Specifically, given the UAVs' trajectories and data rates, we solve the NOMA user pairing, and user-UAV association subproblem optimally by exploiting its special structure. Then, we describe how to optimize the users' data rates and tackle the UAV trajectory optimization in the second and third subproblems, respectively, by using the successive convex approximation (SCA) method. Numerical results show that our proposed algorithm can provide efficient active-inactive schedules (by setting user's transmit powers to zero), and lower energy consumption compared to an existing baseline, and an OMA-based resource allocation and UAV-trajectory optimization strategy.