---
title: "How to enable scrolling in scroll view in Objective-C?"  
description: "How to enable scrolling in scroll view in Objective-C?"  
author: "zack mathews"  
published: 2016-02-15  
updated: 2016-02-15  
canonical: https://www.mindstick.com/forum/33983/how-to-enable-scrolling-in-scroll-view-in-objective-c  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 1 minute  

---

# How to enable scrolling in scroll view in Objective-C?

I want to enable scrolling in our scroll view. I have created an app using **scrollview** and **set** an **[image](https://www.mindstick.com/articles/23551/an-investigate-distinctive-seafood-restaurant-for-your-image-stamp-character)**. using this [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii):

```
UIImageView *imgView = [[UIImageView alloc] initWithImage: [UIImage imageNamed:@"wall-1.jpg"]];scrollview.scrollEnabled=YES;[scrollview addSubview:imgView];
```

In the above code I also set **scrollEnabled** [property](https://www.mindstick.com/blog/205/property-notification-in-c-sharp) to **[YES](https://www.mindstick.com/forum/157763/how-to-return-yes-no-based-on-date-comparison-in-sql)** using **scrollview outlet**, but scrolling is not working.\
[Please suggest](https://answers.mindstick.com/qa/43506/please-suggest-the-bathing-date-at-kumbh) me how can I enable the scrolling [feature](https://www.mindstick.com/articles/12788/how-to-boost-sales-using-magento-2-checkout-feature) in our application.\
Thanks.

## Replies

### Reply by Tarun Kumar

Your code is correct but needed one thing more to do. To enable scrolling in your scrollview, **set the content size of scrollview** and your problem will be solved.\
Below I am providing complete code, in that code I have added one extra line of code:

```
UIImage *img = [UIImage imageNamed:@"wall-1.jpg"];UIImageView *imgView = [[UIImageView alloc] initWithImage:img];scrollview.scrollEnabled = YES;// this code is responsible for scrolling in your scrollview.[scrollview setContentSize:CGSizeMake(img.size.width, img.size.height)];[scrollview addSubview:imgView];
```

That's it. after using above code you will see scrolling functionality is enabled now.\
Now I want to tell you that you called a method **scrollEnabled**, there is no need to set this here, without using this scrolling will work perfectly.


---

Original Source: https://www.mindstick.com/forum/33983/how-to-enable-scrolling-in-scroll-view-in-objective-c

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
