The magnetoresistance of both twinned and detwinned single crystals of YBa2Cu3O7-delta was Measured as a function of magnetic field strength, orientation, and temperature to determine the pinning properties of twin boundaries and their effect on the flux-lattice melting transition. Pinning by twin boundaries manifests itself as a drop in the resistance for magnetic fields oriented within a ''depinning angle'' of the twin boundaries. The onset of twin-boundary pinning is found to occur at the shoulder observed in the low-temperature end of the magnetic-field-broadened resistive transition for H parallel-to c. Two unique current to twin-boundary configurations were employed to induce vortex motion parallel or perpendicular to the twin boundaries when the magnetic field is parallel to the c axis. We find the drop in the angular-dependent resistance, the depinning angle, and the zero-resistance temperature to be enhanced when the vortices move normal to the twin boundaries indicating that the pinning barriers for this direction of flux motion are significantly larger. The depinning angle for rotations off the c axis decreases with increasing magnetic field and decreasing temperature whereas for rotations in the ab plane it is nearly field independent. For applied magnetic fields less than 4 T the depinning angle for H rotated off c is larger than that for H parallel-to ab. Strong pinning by twin boundaries competes with the flux-lattice melting transition for tilt angles less than the depinning angle, totally suppressing the transition for H parallel-to c. For small misalignments off the twin boundaries a second kink is observed which marks the onset of non-Ohmic behavior and which we interpret as the flux-lattice melting transition. For angles larger than the depinning angle the field-broadenend resistive transition and the flux-lattice melting transition of twinned and detwinned crystals are shown to be essentially identical.