Since the cause for the disease has not been found yet, there is no possible way to prevent it. People with this disease can only prevent the symptoms to become more severe and try to relieve the pain for a better quality of life.
Changes in the diet can help relieve the pain and improve the quality of life of ulcerative colitis patients. In general you should avoid any kind of food that causes discomfort and pain. Try to lead a 'food diary' in order to find out which food/food groups provokes the symptoms.
Also try to avoid:
Spicy and highly seasoned foods
Raw fruits and vegetables