iOS(oprating system) Lab file


                                                   iOS Lab Manual File 

 

Sr.No 

List of Experiments in iOS 

Date 

 

 

1. 

Case Study Basic feature of Mac System 

 

22/8/22 

 

 

2 

Case Study how to work XCode and tools 

 

29/8/22 

 

3 

Case Study Difference Between iOS Mac and Windows 

 

 

 

5/9/22 

 

4 

Design an iOS App of UISwitch using Objective C language. 

 

 

 

12/9/22 

 

5 

Design an iOS App of UISlider using Objective C language. 

 

19/9/22 

 

6 

Design an iOS App of UIStepper using Objective C language. 

 

18/9/22 

 

7 

Design an iOS App of UIAnimation using Objective C language. 

 

26/9/22 

 

8 

Design an iOS App of UIDatePicker using Objective C language. 

27/9/22 

 

 

9 

Write a program to print  hello world using objective c language 

 

3/10/22 

 

10 

Write a program to print even number using objective c language 

 

4/10/22 

11 

Write a program to print even number and odd number using objective c language 

 

10/10/22 

 

12    

Write a program to print week day using objective c language 

 

17/10/22 

 

13    

Write a program to print table using objective c language 

 

18/10/22 

14 

Write a program to print hello threre using objective c language 

 

7/11/22 

 

15 

Write a program to print table of 4 using objective c language 

 

21/11/22 

 

16 

 

Write a program to print value of array using objective c language 

 

28/11/22 

17 

Write a program to print table of 13 using objective c language 

 

5/12/22 

 

18 

Write a program to print number 10 to 19 using objective c language 

12/12/22 

 

 

 

 

 

 

 

 

  

 

 

 

 

Case Study: 1 

 

Aim:      Basic feature of Mac System 

About the Finder 

The Finder is the program that manages your files, applications, disks, network connections, and devices such as printers. The Finder is always on when your computer is running, though it may be in the background if you’re using another program such as Mail. To display a Finder window, click the Finder icon in the Dock (it’s always the first icon in the Dock) 

 

About the Dock 

You use the Dock to open applications, documents, folders, and more. By default, it appears across the bottom of the screen. 

The Dock comes with icons for some applications, such as Mail and iTunes; you can add others. When you minimize a window or open an application that isn’t in the Dock, its icon appears in the Dock. 

Each item in the Dock has a shortcut menu that gives you quick access to commands for that item. The shortcut menu also contains the commands “Remove from Dock” for icons that have been placed there permanently, and “Keep in Dock” for applications that are open but whose icons are only there temporarily. 

You can customize the Dock by changing its magnification, repositioning it, and more. To change Dock preferences, choose Apple menu > Dock. 

 

 

 

 

 

 

Working with text 

These keyboard shortcuts are useful when working with text in word processors, email applications, and more. They can help you perform commonly repeated tasks, like copying and pasting text. 

  • Command+X: Cut the selected text. 

  • Command+C: Copy the selected text. 

  • Command+V: Paste the copied or cut text. 

  • Command+A: Select all of the text on the page or in the active window. 
    Command+B: Bold the selected text. 

  • Command+I: Italicize the selected text. 

  • Command+U: Underline the selected text 

Safari 

Safari is an easy-to-use web browser built for Mac and has many of the same features as other browsers. Bookmarks can be shared across your devices, and a built-in menu helps you share webpages on social media. 

 

 

 

 

 

 

Mail 

The Mail app downloads your email to your computer and organizes it. The app also acts as a new interface for your email and has features like Markup, which allows you to draw on attachments. 

 

 

 

 

 

App Store 

The App Store provides a seamless way to search for, purchase, and install apps online. It also updates your apps automatically while you are doing other things. 

 
 

iTunes 

iTunes gives you access to Apple's expansive online store of music, movies, and TV shows. iTunes saves and plays your media on your computer and can help organize your media into custom playlists. 

 

 

 

 

Messages 

Messages can connect to multiple instant-messaging services and organizes your chats all in one app. It also supports video and audio chats on some services. 

 
 

About This Mac 

From the Apple menu in the corner of your screen, choose About This Mac. You should see an overview of your Mac, including its model name and serial number. 

 

 

 

 

 

 

 

 

Case Study: 2 

Aim: how to work XCoder and tools  

Xcode is an application that developers use to build apps for Apple’s various platforms such as iPhone, iPad, Macs, AppleTV and Apple Watch. 

 

Keep in mind that you can adjust the size of each of those panes by hovering your cursor over the boundaries of each area and dragging. 

You can also show and hide the various areas as needed via the “View” buttons in the upper right hand corner: 

 

 

 

This can be helpful, for example, when you’re writing code and you don’t need the debugger area or the utility area. Then you can use the View buttons to hide those 2 panes to give your editor more visible space. 

 

The Xcode Project Navigator 

The Project Navigator is where you’ll see all the files associated with your project. This is the default tab you’ll see when you create a brand new Xcode project. 

 

 

 

Organizing your files 

Within the Project Navigator, you can also create Groups to organize your files in. Think of them like folders. You can create a new Group and then drag your files into them to organize your project a little bit. 

 

Creating and adding new files 

You can also right click on the Project Navigator and create new files or add existing files to your project. Or you can drag folders or files from your computer directly onto the Project Navigator and will popup a dialog asking how you want to add the files. 

 

 

   

Editing files 

If you click on a file in the Project Navigator, it will display the contents of that file in the Editor Area so that you can edit that file. 

The Xcode Search Navigator 

With the search navigator tab, you can easily look for pieces of text in your project. 

 

You’ll find yourself using this a lot when you’re looking for a specific property, method or variable and you can’t remember exactly where it is. 

One of my favorite Xcode shortcuts is cmd+shift+F. Hitting these keys is going to switch to the Search Navigator to perform a project-wide search. This really helps when you need to make a change in multiple places in a project. 

The Xcode Issue Navigator 

The issue navigator shows you all the problems with your app. 

 

When you build and compile your application to test, if there are some problems where Xcode can’t build your app, it will halt and show you the red colored errors in the issue navigator. You can click on an error and it will show you in the editor area which file and line it’s failing at. 

It will also show yellow Warnings in the issue navigator. Although resolving warnings is not necessary for building your app, they’re warnings that there may be potential issues. 

Similarly, when you’re building your user interface in Xcode, any errors will also show itself in the Issue Navigator. 

Writing Code 

Click on a Swift file from the Project Navigator and you’ll see something like this: 

 

 

Configuring Xcode project properties 

The root node of the project navigator is your Xcode project file (indicated by the blue icon). If you click that, the project properties will open in the editor area. 

 

You’ll visit the project properties screen quite Inserting image...a bit during the process of building your app. In this screen, you can configure things like: 

  • Set the name of your app 

  • The bundle identifier (your unique ID for the app) 

  • Allow your app to work on multiple device orientations 

  • Set the version of your app 

  • Set the minimum required iOS version that your app can be install on 

  • Add additional Apple frameworks and libraries 

  • Indicate your code signing options which are mandatory for submitting your app to the App Store (if you have code signing errors, this is where you’d fix it!) 

  • There’s a lot more! 

Xcode 11 brings two different ways of building the user interface (UI) for your app: Storyboards or SwiftUI. 

When you create a new Xcode project, you’ll see a dropdown to choose one of these two options: 

 
 

 

 

 

 

 

Storyboards are interfaces built with visual drag and drop in the Editor Area using Interface Builder. 

 

SwiftUI was released in late September 2019 as a new way to build user interfaces by writing code. Xcode 11 has a special Preview Canvas pane that shows your user interface change in real time as you write the code to modify your user interface. 

 

 

 

 

 

 

 

 

 

 

 

 

Case Study: 3 

Aim: Difference Between iOS Mac and Windows 

 

The main difference between Mac and Windows is its interface. Mac has a simple and subtle interface whereas Windows is a feature-rich but complicated interface. You can run Windows on Mac OS but you can’t run macOS on Windows yet. 

Parameters of Comparison 

Mac 

Windows 

Developers 

Mac or Macintosh is developed and designed by Apple Incorporation. 

Windows is developed and designed by Microsoft Incorporation. 

Launching Year 

Macintosh was launched in the year 2001. 

Windows was launched in the year 1985 

Compatible Devices 

Mac is designed to be specifically used only for Apple products. 

Windows is designed to be used for every PC in general. 

Latest Version 

The latest version of Macintosh is 11.0 Big Sur. 

Windows 10 is known as the latest version of Windows. 

Type of Kernel 

Macintosh has a Hybrid type of Kernel. 

Windows also has the Hybrid type of Kernel. 

Package Installer 

The package installer for Macintosh is MacOS. 

The package installer for Windows is MSI (Medium Scale Integration )or any other custom package installer. 

Software Update 

The software update package for Macintosh is Software Update. 

The software update package for Windows is Windows update. 

Native APIs 

Macintosh deals with Java, Cocoa, Carbon BSD-POSIX as the Native APIs. 

Windows deals with Win32 and NT API as the Native APIs. 

Supported Files 

Macintosh supports APFS, HFS, and HFS+, UFS, AFP, ISSO 9660, UDF,NFS,FAT, SMBFS,NTFS, FTP, WebDAV and ZFS etc. 

Windows supports NTFS, APFS, ISO 9660, UDF, HFS+, FATX, and HFS. 

 

 

 

 

 

 

 

 Practical No: 1 

Aim: Design an iOS App of UISwitch using Objective C language. 

Software used: XCODE 

Steps to perform UISwitch: 

                                                                                                                           

1. Launch Xcode from your Dock or Launchpad (if not available on Dock). Take help of your instructor, if unable to find the Xcode in your workstation. 2. Choose Single View Application from the Project Template and click Next. 

 

3. Give suitable Project Name, Organization Name, Company Identifier, Class Prefix. Can refer the following screenshot. Make sure Device is iPhone only. Then click Next 

 

 

 

 

 

 

 

 

4. Select the destination to save the project (anywhere in your workstation) and click Create 

 

5. Your Xcode has launched developer environment for you. 

 

 

6. Navigate to Main.storyboard from left pane of Xcode IDE. Then find out UISwitch from Object Library available in bottom right section of Xcode IDE. 

 

7. Drag the UISwitch in your storyboard and align it as per your convenient. Same way find out and placed UILabel in your storyboard. 

 

8. Enable the Assistance Editor by clicking on   

 

 Make sure you have select ViewController.h from 

 Drag a connection from UISwitch to ViewController.h file like the following image. To do so you have press and hold the button from the keyboard and then click on the UISwitch and drag it to the ViewController.h. 

 

9. Now it will ask for the connection details. Create a method for the UISwitch by assigning Connection type as Action, a suitable Name (e.g. switchChange) and let other sections with default value like below screenshot. Now hit Connect button. 

 

10. Same way create connection for the UILabel like below screenshot. 

 

11. But this time create Outlet rather than Action for the UILabel. So declare Connection type as Outlet, give a suitable Name (e.g. changeStatus) and let other sections with default value like following screenshot. Then click Connect. 

 

12. Like UILabel, create an outlet connection for UISwitch as well like following screenshot. 

 

13. Assign the Connection type as Outlet, a suitable Name (e.g. mySwitch) and keep others as default. Then click Connect. 

 

14. Make sure your ViewController.h exactly looks like this. 

 

15. Now jump to the ViewController.m file from where you will implement your actual logic. 

 

16. Make your ViewController.m as bellow. 

 

 

17. Done with development. 

Now clickon or hit Command+R button from keyboard to compile and run into simulator 

 

 

 

 

 

Practical No: 2 

Aim: Design an iOS App of UISlider using Objective C language. 

Software used: XCODE 

Steps to perform UISlider: 

1. Launch Xcode from your Dock or Launchpad (if not available on Dock). Take help of your instructor, if unable to find the Xcode in your workstation. 2. Choose Single View Application from the Project Template and click Next. 

 

3. Give suitable Project Name, Organization Name, Company Identifier, Class Prefix. Can refer the following screenshot. Make sure Device is iPhone only. Then click Next. 

 

4. Select the destination to save the project (anywhere in your workstation) and click Create. 

 

5. When Xcode launched the IDE, navigate to Main.storyboard from left pane of Xcode IDE. Then find out UISlider from Object Library available in bottom right section of Xcode IDE. 

 

6. Drag the UISlider in your storyboard and align it as per your convenient. Same way find out and placed UILabel in your storyboard. 

 

7. Enable the Assistance Editor by clicking on 

 

Make sure you have select ViewController.h from 

 

Drag a connection from UISlider to ViewController.h file like the following image. To do so you have press and hold the Control button from the keyboard and then click on the UIStepper and drag it to the ViewController.h. 

 

8. Now it will ask for the connection details. Create a method for the UISlider by assigning Connection type as Action, a suitable Name (e.g. sliderChange) and let other sections with default value like below screenshot. Now hit Connect button. 

 

9. Same way create Outlet connection for the UILabel like below screenshot. So declare Connection type as Outlet, give a suitable Name (e.g. changeValue) and let other sections with default value like following screenshot. Then click Connect. 

 

10. Assign the Connection type as Outlet, a suitable Name (e.g. mySlider) and keep others as default. Then click Connect. 

 

14. Make sure your ViewController.h exactly looks like this. 

 

15. Now jump to the ViewController.m file from 

 

where you will implement your actual logic. 

16. Make your ViewController.m as bellow 

 

17. Done with development. 

 Now clickon or hit Command+R button from keyboard to compile and run into 

Simulator. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Practical No: 3 

Aim: Design an iOS App of UIStepper using Objective C language. 

Software used: XCODE 

Steps to perform UIStepper: 

1. Launch Xcode from your Dock or Launchpad (if not available on Dock). Take help of your instructor, if unable to find the Xcode in your workstation. 2. Choose Single View Application from the Project Template and click Next. 

 

3. Give suitable Project Name, Organization Name, Company Identifier, Class Prefix. Can refer the following screenshot. Make sure Device is iPhone only. Then click Next. 

 

4. Select the destination to save the project (anywhere in your workstation) and click Create 

 

5. When Xcode launched the IDE, navigate to Main.storyboard from left pane of Xcode IDE. Then find out UIStepper from Object Library available in bottom right section of Xcode IDE. 

 

6. Drag the UIStepper in your storyboard and align it as per your convenient. Same way find out and placed UILabel in your storyboard. 

 

7. Enable the Assistance Editor by clicking on Make sure you have select ViewController.h from 

 

Drag a connection from UIStepper to ViewController.h file like the following image. To do so you have press and hold the Control button from the keyboard and then click on the UIStepper and drag it to the ViewController.h. 

 

8. Now it will ask for the connection details. Create a method for the UISwitch by assigning Connection type as Action, a suitable Name (e.g. changeStepper) and let other sections with default value like below screenshot. Now hit Connect button. 

 

9. Same way create connection for the UILabel like below screenshot. 

 

10. But this time create Outlet rather than Action for the UILabel. So declare Connection type as Outlet, give a suitable Name (e.g. changeValue) and let other sections with default value like following screenshot. Then click Connect. 

 

11. Like UILabel, create an outlet connection for UIStepper as well like following screenshot. 

 

12. Assign the Connection type as Outlet, a suitable Name (e.g. myStepper) and keep others as default. Then click Connect. 

 

13. Make sure your ViewController.h exactly looks like this. 

 

14. Now jump to the ViewController.m file from where you will implement your actual logic 

 

15. Make your ViewController.m as bellow. 

 

16. Done with development. 

Now clickon or hit Command+R button from keyboard to compile and run into simulator. 

  

 

Practical No: 4 

Aim: Design an iOS App of UIAnimation using Objective C language. 

Software used: XCODE 

Steps to perform UIAnimation: 

1.Launch Xcode from your Dock or Launchpad (if not available on Dock). Take help of your  

Instructor, if unable to find the Xcode in your workstation. 

2. Choose Single View Application from the Project Template and click Next. 

 

3. Give suitable Project Name, Organization Name, Company Identifier, Class Prefix. Can refer the following screenshot. Make sure Device is iPhone only. Then click Next. 

4. Select the destination to save the project (anywhere in your workstation) and click Create. 

5. When Xcode launched the IDE, jump to the Main.storyboard from left side navigator. 

6. Add an UIImageView and resize it. 

 

7.Then find an image (here ball.png) and drag it to your project Navigation Area. Immediately one dialog box appear, let all settings as default and click Finish. 

 

8. Now select the UIImageView from your StoryBoard and form your Utility Area’s Attribute  

Inspector, chose that newly added image and immediately your UIImageView get an image to  

Display.  

 

9. Then change the background of your View and try to make the view looks like as below image. 

 

10. Connect this ball image with ViewController.h as an Outlet and name it ball. 

11. Now write the code as below. 

 

 

 

13. That’s it, now run your project. 

 

 

 

 

 

 

 

 

 

 

 

 

 

Practical No: 5 

Aim: Design an iOS App of UIDatePicker using Objective C language. 

Software used: XCODE 

Steps to perform UIDatePicker: 

1. Launch Xcode from your Dock or Launchpad (if not available on Dock). Take help of your instructor, if unable to find the Xcode in your workstation. 2. Choose Single View Application from the Project Template and click Next. 

 

3. Give suitable Project Name, Organization Name, Company Identifier, Class Prefix. Can refer the following screenshot. Make sure Device is iPhone only. Then click Next. 

 

4. Select the destination to save the project (anywhere in your workstation) and click Create. 

 

5. When Xcode launched the IDE, navigate to Main.storyboard from left pane of Xcode IDE. Then find out UIDatePicker from Object Library available in bottom right section of Xcode IDE. 

 

6. Drag the UIDatePicker in your storyboard and align it as per your convenient. Same way find out and placed one UILabel and one UIButton in your storyboard. 

 

 

 

7. Select the UIDatePicker and show Attribute Inspector by selecting 

   

Then change the Mode to Date. 

 

 

 

7. Enable the Assistance Editor by clicking on 

 

Make sure you have select ViewController.h from 

 

8. Create connection with UIButton as an Action. The create connections with both UILabel and UIDatePicker as Outlets 9. Make sure your ViewController.h exactly looks like this. 

 

 10. Now jump to the ViewController.m file from 

 

where you will implement your actual logic. 

11. Make your ViewController.m as bellow. 

 

 

12. Done with development. 

Now click 

  

on or hit Command+R button from keyboard to compile and run into simulator 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Practical No: 6 

Aim:- Write a program to print  hello world using objective c language  

Source code 

 

 

Output 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Practical No: 7 

Aim:- Write a program to print even number using objective c language  

 

  Source code: 

 

Output 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Practical No: 8 

Aim:- Write a program to print even number and odd number using objective c language 

Source code: 

 

Output 

 

 

 

 

 

 

 

 

 

 

Practical No: 9 

Aim:- Write a program to print week day using objective c language 

Source Code 

#import <Foundation/Foundation.h> 

 Int main (){ 

    Int week = 3; 

    Switch(week) { 

        Case 0: NSLog(@”Today is Sunday.”); 

            Break; 

        Case 1:  NSLog(@”Today is Monday.”); 

            Break; 

        Case 2: NSLog(@”Today is Tuesday.”); 

            Break; 

        Case 3: NSLog(@”Today is Wednesday.”); 

            Break; 

        Case 4: NSLog(@”Today is Thursday.”); 

            Break; 

        Case 5:  NSLog(@”Today is Friday.”); 

            Break; 

        Case 6: NSLog(@”Today is Saturday.”); 

            Break; 

        Default:  NSLog(@”Something went wrong!”); 

            Break;  } 

 Return 0;} 

Output 

 

 

 

 

 

 

 

Practical No: 10 

Aim:- Write a program to print table using objective c language 

Source Code 

#import <Foundation/Foundation.h> 

  

int main () 

{ 

    int num = 4;; 

    do 

    { 

        NSLog(@"Hello there,"); 

    } while (num<3); 

     

    return 0; 

} 

Output 

 

 

 

 

 

 

 

Practical No: 11 

Aim:- Write a program to print hello threre using objective c language 

Source Code 

#import <Foundation/Foundation.h> 

  

int main () 

{ 

    int num = 4;; 

    do 

    { 

        NSLog(@"Hello there,"); 

    } while (num<3); 

     

    return 0; 

} 

 

Output 

 

 

 

                                       

 

 

 

 

 

 

 

 

 

 

 

 

Practical No: 12 

Aim:- Write a program to print table of 4 using objective c language 

Source Code 

 

Output 

 

 

 

 

 

 

Practical No: 13 

Aim:- Write a program to print value of array using objective c language 

Source Code 

#import <Foundation/Foundation.h> 

  

int main () 

{ 

    int myNums[] = {1, 23, 53, 10}; 

 

    NSLog(@"Value at Position No.2 or Index No.1 = %d", myNums[1]); 

     

    return 0; 

} 

 

Output 

 

 

 

 

 

 

 

Practical No: 14 

Aim:- Write a program to print table of 13 using objective c language 

Source Code: 

 

Output 

 

                                                  

 

 

                                                                  Practical No: 15 

Aim:- Write a program to print number 10 to 19 using objective c language 

Source Code: 

 

 

 

Output 

 

 

   

 

Practical No: 16 

Aim:- Write a program to print AND, OR, NOT oprator value using objective c language 

Source Code: 

 

#import <Foundation/Foundation.h> 
 
int main () 
{ 
    int x=1, y=0, z=1; 
     
    NSLog(@"%d", x&&y); 
    NSLog(@"%d", x&&z); 
    NSLog(@"%d", x||y); 
    NSLog(@"%d", !x); 
    NSLog(@"%d", !y); 
     
    return 0; 
} 

 Output 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Practical No: 17 

Aim:- Write a program to print reletional oprator value using objective c language 

Source Code: 

 

#import <Foundation/Foundation.h> 
 
int main () 
{ 
    int x=15, y=6; 
     
    NSLog(@"%d", x==y); 
    NSLog(@"%d", x!=y); 
    NSLog(@"%d", x>y); 
    NSLog(@"%d", x<y); 
    NSLog(@"%d", x>=y); 
    NSLog(@"%d", x<=y); 
     
    return 0; 
} 

Output 

 

 

 

 

 

 

 

 

 

 

Practical No: 18 

Aim:- Write a program to print sum of two numbers using objective c language 

Source Code: 

#import <Foundation/Foundation.h> 
 
int main() { 
 
    int x = 10; 
    int y = 20; 
    int sum = x + y; 
    NSLog(@"Sum = %d", sum); 
     
    return 0; 
} 

 

Output 

 

 

Comments

Popular Posts