iOS devices and Macs usually have only one iCloud account associated with them. If you have multiple Apple IDs, you will have to sign out with one ID before you can use another. You may also need to delete an account if you share the device with family members. If you bought your iOS device used, the previous owner will need to delete his or her old account before you can sign in with your own account.
Method 1 of 3: iPhone, iPad and iPod
Step #1. Open the Settings app
If you want to switch iCloud accounts on your iOS device, you can do so in the Settings app.
If you're trying to switch iCloud accounts on an iOS device you just bought used, go to the latter method
Step 2. Tap on "iCloud" option
The current iCloud account is now displayed at the top of the screen.
Step 3. Scroll down and tap "Sign Out" or "Delete Account"
The name of the option depends on which version of iOS you're using, but either option will accomplish the same thing.
If you recently changed your Apple ID email address and the new email address isn't shown, tap your old email address at the top of the screen and enter your new password. This way you should be able to delete the account
Step 4. Confirm that you want to delete the account
You will be notified that the files and photos in your iCloud account will be removed from your iOS device when you log out.
Step 5. Enter the password of the old account's Apple ID
You must enter this password to delete the old iCloud account.
Step 6. Decide what to do with your other iCloud data
You'll be asked to choose what to do with your Safari data, your calendar and reminder notes, and your contacts. You can leave them on your device or delete them as well.
Step 7. Enter the Apple ID and password of the account you want to add
After you have logged out with your old account, you can log in with the new account. Enter your Apple ID email address and password.
If you forgot your Apple ID or password, tap the blue "Forgot Apple ID or password?" link. You will now be sent to the iForgot website where you can reset your password or recover your ID
Step 8. Choose your iCloud services
After logging in, you will be able to choose which iCloud services you want to enable on your device.
Method 2 of 3: OS X
Step 1. Click on the Apple menu and choose "System Preferences"
The "System Preferences" menu will now open.
Step 2. Choose the "iCloud" option
You will see your iCloud settings.
Step 3. Click the "Log Out" button
You will be asked to confirm that you want to sign out of your iCloud account. All your iCloud data, including calendar events and photos, will be removed from your Mac.
If you get an error message when you try to sign out, it could be due to a problem with your iPhone or other iOS device. Open the Settings menu on your iOS device and choose "iCloud." Enable the "Keychain" option and try logging out of your Mac again
Method 3 of 3: Second-hand iOS devices
Step 1. Contact the previous owner
If you bought a used iPhone from someone and that person's iCloud account is still signed in, you'll need to contact that person and ask them to remove the iPhone from their account. There is no other way to delete the account from the device as you will still be prompted for the other person's login information even after a factory reset.
Step 2. Ask the previous owner to login to the iCloud website
The previous owner can quickly remove the iPhone from his or her account on the iCloud website. Tell the person to sign in to icloud.com with the account connected to your device.
Step 3. Tell the person to click the "Settings" button on the iCloud website
Now the iCloud settings page will open.
Step 4. In the list of devices, have the previous owner click on his or her old iPhone
A new window will now open with the properties of the iPhone.
Step 5. Tell the other person to click the "X" button next to the iPhone's name
This will remove the iPhone from the account, so you can log in with your own iCloud account.