Guide To Display Images In Grid View On IPhone

In some iOS apps, displaying images in a single view would make the UI lose its uniformity. It would be difficult to manage images of different resolution and impossible to keep track of thousand of images without using Grid View in iPhone.

This is just like a “Grid View” application. Here we will explore how to display images, programmatically in “Grid view” on an iPhone.

Here We Go…

Step 1:

  • Open Xcode
  • Create a View base applicationGridview-123
  • Give the application name “ImageGrid”.

Step 2:

The directory structure is automatically created by the Xcode which also adds up essential frameworks to it. Now, explore the directory structure to check out the contents of the directory.

Step 3:

Here you need to add one ‘NSObject’ class to the project.

  • Select  project -> New File -> Cocoa Touch -> Objective-C class
  • Give the class name “Images”.

Step 4:

Then add an image to the project and give the image name “icon.png”.

Step 5:

  • Open “ImageGridViewController” file and add ‘UITableViewDelegate’ and ‘UITableViewDataSource’
  • Define ‘UITableView’ and ‘NSMutableArray’ classes as well as the buttonPressed: method
  • Import the ‘Image.h’ class and make the following changes.

[sourcecode]#import <UIKit/UIKit.h>
#import "Image.h"
@interface ImageGridViewController:UIViewController <UITableViewDelegate, UITableViewDataSource> {
IBOutlet UITableView *tableView;
NSMutableArray  *sections;
}
@property (nonatomic, retain) UITableView *tableView;
@property (nonatomic, retain) NSMutableArray *sections;
-(IBAction)buttonPressed:(id)sender;
@end[/sourcecode]

Step 6:

  • Double click the ‘ImageGridViewController.xib’ file and open it in the Interface Builder.
  • First drag the ‘TableView’ from the library and place it in the view window.
  • Select ‘tableview’ from the view window and bring up connection inspector and connect ‘dataSource’ to the ‘File’s Owner’ and delegate to the ‘File’s Owner’ icon.
  • Now save the .xib file and go back to Xcode.

Step 7:

In the ‘ImageGridViewController.m’ file, make the following changes:

[sourcecode]#import "ImageGridViewController.h"
#import "Item.h" @implementation ImageGridViewController
@synthesize tableView,sections;

-(void)loadView{

[super loadView];
sections = [[NSMutableArray alloc] init];

for(int s=0;s<1;s++) { // 4 sections
NSMutableArray *section = [[NSMutableArray alloc] init];

for(int i=0;i<12;i++) {// 12 items in each section
Image *item = [[ Image alloc] init];
item.link=@"New Screen";
item.title=[NSString stringWithFormat:@"Item %d", i];
item.image=@"icon2.png";

[section addObject:item];
}
[sections addObject:section];
}
}

– (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return [sections count];
}

– (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 1;
}

– (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath {
NSMutableArray *sectionItems = [sections objectAtIndex:indexPath.section];
int numRows = [sectionItems count]/4;
return numRows * 80.0;
}

-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {

NSString *sectionTitle = [NSString stringWithFormat:@"Section  %d", section];
return sectionTitle;
}

– (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static    NSString *hlCellID = @"hlCellID";

UITableViewCell *hlcell = [tableView dequeueReusableCellWithIdentifier:hlCellID];
if(hlcell == nil) {
hlcell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault reuseIdentifier:hlCellID] autorelease];
hlcell.accessoryType = UITableViewCellAccessoryNone;
hlcell.selectionStyle = UITableViewCellSelectionStyleNone;
}

int section = indexPath.section;
NSMutableArray *sectionItems = [sections objectAtIndex:section];

int n = [sectionItems count];
int i=0,i1=0;

while(i<n){
int yy = 4 +i1*74;
int j=0;
for(j=0; j<4;j++){

if (i>=n) break;
Image *item = [sectionItems objectAtIndex:i];
CGRect rect  = CGRectMake(18+80*j, yy, 40, 40);
UIButton *buttonImage=[[UIButton alloc] initWithFrame:rect];
[buttonImage setFrame:rect];
UIImage *buttonImageNormal=[UIImage imageNamed:item.image];
[buttonImage setBackgroundImage:buttonImageNormal forState:UIControlStateNormal];
[buttonImage setContentMode:UIViewContentModeCenter];
NSString *tagValue = [NSString stringWithFormat:@"%d%d", indexPath.section+1, i];
buttonImage.tag = [tagValue intValue];
//NSLog(@tag….%d", button.tag);
[buttonImage addTarget:self
action:@selector(buttonPressed:)forControlEvents:UIControlEventTouchUpInside];
hlcell.contentView addSubview:buttonImage];
[buttonImage release];

UILabel *label = [[[UILabel alloc]initWithFrame:CGRectMake((80*j)-4,                 yy+44, 80, 12)] autorelease];
label.text = item.title;
label.textColor = [UIColor blackColor];
label.backgroundColor = [UIColor clearColor];
label.textAlignment = UITextAlignmentCenter;
label.font = [UIFont fontWithName:@"ArialMT" size:12];
[hlcell.contentView addSubview:label];
i++;
}
i1 = i1+1;
}
return hlcell;
}
-(IBAction)buttonPressed:(id)sender {
int tagId = [sender tag];
int divNum = 0;
if(tagId<100)
divNum=10;
else
divNum=100;
int section = [sender tag]/divNum;
section -=1;// we had incremented at tag assigning time
int itemId = [sender tag]%divNum;
NSLog(@"…section = %d, item = %d", section, itemId);
NSMutableArray*sectionItems = [sections objectAtIndex:section];
Image    *item    =    [sectionItems objectAtIndex:itemId];
NSLog(@"Image selected…..%@, %@", item.title, item.link);

}

-(void)viewDidLoad{
[super viewDidLoad];
}

-(void)didReceiveMemoryWarning{
[super didReceiveMemoryWarning];
}

-(void)viewDidUnload{
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}

-(void)dealloc{
[super dealloc];
}
@end[/sourcecode]

Step 8:

Open the ‘Image.h’ file and make the following changes:

[sourcecode]#import <Foundation/Foundation.h>
@interface Image:NSObject{
NSString*title;
NSString*link;
NSString*image;
}
@property(nonatomic, copy)NSString*title;
@property(nonatomic, copy)NSString*link;
@property(nonatomic, copy)NSString*image;
@end[/sourcecode]

Step 9:

Make the changes in the ‘Item.m’ file:

[sourcecode]#import "Image.h"
@implementation Item
@synthesize title, link, image;
@end[/sourcecode]

Step 10:

Now save it and compile it in the Simulator.

It would be smart to use Grid View to display a number of images in a single view because it enables to manage multiple images efficiently. Users are also facilitated to keep track of their images. It becomes eye soothing and looks great on the iPhone mobile devices.

Keep visiting regularly to Andolasoft blog to know our upcoming article about the process to show your android Smartphone captured images dynamically in “Grid View” Layout.

IPhone 5S And IPad 5 Is Expected To Launch On 29th Of June

Apple’s next big thing is expected to lunch iphone 5s and ipad 5 on 29th of June of this year. Apparently iPhone 5S Smartphone will be entering the consumer market much earlier than what was expected. It is designed as a high-end sibling of the present generation iPhone 5. DigiTimes has revealed that the IPhone 5S will feature a faster processor, based on Apple’s ARM processing cores. They have also claimed that, it will have a higher-resolution camera than its previous models. These features can be disappointing for most users who find the phone’s design to be little boring and outdated compared to other major smart device manufacturers. But the next-generation iPhone 6 is expected to bring a fresh, updated and completely re-designed phone. Rumors have it that its design is inspired form iPad mini tablet.

Never miss an update from us. Join 10,000+ marketers and leaders.

DigiTimes’ sources has also pointed out that deliveries of essential iPhone 5S components are already scheduled to May, which makes sense that the launch date might be true. Resources have also stated that Apple is planning to launch iPad5 along with the iPhone 5S in an event on 29thof June. While unconfirmed from Apple, this date fits well with the earlier humors of the launch, but the inclusion of iPad 5 comes as something of a surprise. And these devices might be running iOS 7.

DigiTimes has released in their website stating-“Components for the next-generation iPhone will start shipping at the end of May with the new smartphone to have a chance of showing up in the third quarter, according to sources from the upstream supply chain.”

The new iPhone will not receive a major upgrade and may just be a slightly enhanced version of iPhone 5 (iPhone 5S), the sources said citing their latest specification data.”

If the event does really take place in June, It will be something of a test to iPhone 5S and iPad-5. This could also be the deciding factor of the company’s future. It will be the first major release from the company since the death of its co-founder Steve Jobs.

Major iphone application development company are also looking forward to the release of the new iPhone as well as the iOS 7. It will facilitate them to develop apps for the new OS with numerous new features and functionalities.

What Is The Key Points For Successful iOS Development?

After the introduction of iOS platform and the application development possibilities, it has paved new business opportunities for the IT industries as well as individual developers.

With the rapidly growing app industry it has become demanding to keep track of changing technology.

Here we have come up with some major key points which should be kept in mind by the developer at the time of iOS application development.

Never miss an update from us. Join 10,000+ marketers and leaders.

    1. Drive revenue for your business by integrating  ‘Geo-Targeted push Notification’, ‘Geo-Targeted Advertising’
    2. Integrate NFC (near field communication) system to your application.
    3. Use App analytics to monitor the app’s influence on the market. Target your audience and bring market specific features to you app.
    4. Avoid these flaws in your mobile app development
    5. Irrelevant push notification in the app
    6. Sending unnecessary “Rate my app” request to users
    7. Integrating Facebook and other social networking sites unnecessarily
    8. Avoid using full screen ads. Users hate this.
    9. Try to prefer building Native Apps for iPhones to web apps, because some web technologies are still not compatible with the iOS platform.
    10. Design intriguing UI to compel the user to use your app. Take inspiration from other successful Mobile application to generate similar experience for the users.
    11. iOS development supports numerous programming languages other than Objective-C, such as Ruby, JavaScript, Node.js etc. Choose the language you are comfortable with.
    12. Design your app so that it uses minimal battery power. Users are more concerned about the phone battery rather than the app itself.
    13. Develop cross-platform apps, so that it can be released for other mobile operating systems.
    14. Never build iPhone app that mimics the look and feel of other operating system.
    15. Never overdo the application animations and graphics.

I’ve worked with the team at Andolasoft on multiple websites. They are professional, responsive, & easy to work with. I’ve had great experiences & would recommend their services to anyone.

Ruthie Miller, Sr. Mktg. Specialist

Salesforce, Houston, Texas

LEARN MORE

iOS applications are the fastest evolving apps in the app industry.

That’s why at Andolasoft, our iPhone application developers keep their skills updated with the latest technology and latest iOS releases to match the competitive market.

Here we develop engaging iPhone application to meet our customer’s business requirements.

iPhone’s iWallet Patent Control The Spending Limit Of Kids

Apple has published latest patent, explaining Apple’s new iwallet concept. It allows the individuals to configure number of accounts, which can be set-up to control the spending limits. This patent is called “Parental Controls” that could help parents to limit their child’s ability to spend money via an iPhone.

Never miss an update from us. Join 10,000+ marketers and leaders.

The control can be configured for categories like, specific places where purchases can take place and the types of transactions which can be allowed. The patent also suggests that, parent will be notified about their child’s activity on the accounts, including the details of the online purchases. The app can also be set for the users, so that they cannot buy some unethical products. The E-Wallet app is enabled with a primary account that is connected to a credit card.

Users are able to use the app to manage transactions using their iPhone. The patent also hints that it will integrate mobile payment solution so that it can be used outside of its ecosystem in the future. It also reveals that the iPhone would integrate NFC (Near field communication) chip for convenience. This technology is still in its early stage of iPhone application development. So NFC enabled monetary transaction may not be secure completely.

I’ve worked with the team at Andolasoft on multiple websites. They are professional, responsive, & easy to work with. I’ve had great experiences & would recommend their services to anyone.

Ruthie Miller, Sr. Mktg. Specialist

Salesforce, Houston, Texas

LEARN MORE

iPhone applications are the fastest evolving apps in the app industry. That’s why at Andolasoft, our iPhone application developers keep their skills updated with the latest technology and iOS releases to match this competitive market. Here we develop engaging iPhone application to meet our customer’s business requirements.

Facebook’s Free Call Service For US iPhone Users

Facebook recently announced that iPhone users could enjoy free calls in the US over Wi-Fi Messenger for iPhone. This new feature facilitates people from the United States that allow them to use the Facebook Messenger app to place voice calls with friends using their internet connection or Wi-Fi.

Never miss an update from us. Join 10,000+ marketers and leaders.

The feature comes as a “Free Call” button in the existing app and the users don’t have to update to take advantage of this feature.

A lot of users quoted “Free call feature is incredibly simple and useful”. But the app also requires the receiver to have Facebook’s stand-alone app installed on their phone.

If the app couldn’t sync with the receiver, the “Free Call” icon appears grey and marked out. The call features look and feel similar to conventional voice calls.

Besides the United States, Facebook has mentioned that they have started testing VoIP functionality in Canada.

I’ve worked with the team at Andolasoft on multiple websites. They are professional, responsive, & easy to work with. I’ve had great experiences & would recommend their services to anyone.

Ruthie Miller, Sr. Mktg. Specialist

Salesforce, Houston, Texas

LEARN MORE

Facebook has also added a voice message feature for the iPhone users. It enables the user to send recorded messages to their Facebook friends. It works similar to a text message, whereas the text is replaced by a bar recorded with the sender’s voice information.

Andolasoft- a leading iPhone application development company offers a comprehensive range of iOS solutions to our global customers. With expertise in HTML 5, CSS, iOS, iPhone SDK, and Cocoa framework, we develop stunning iPhone applications to reach a wider audience.

Apple IPhone Smartwatch Is Expected In This Year

In this current year is supposed to see some amazing technological innovations. This would be the year of wearable smart devices and compact gadgets. From recent news, it is now revealed that tech giants like Apple have decided to develop a smartwatch.

It will be developed to facilitate easy access to Apple devices like the iPhone and iPad. And it is also expected to be available during this year.

‘Apple’ has teamed up with ‘Intel’ to create this Bluetooth-equipped wearable smartwatch to sync operations and notifications with the iPhone.

It would allow the users to remotely access the phone from their wrist, without necessarily holding the phone when needed. That means the users can send text messages, make calls, and update their Facebook status directly from their watches.

With an embedded Siri- integration and a 1.5in display, an iPhone compatible smartwatch is definitely in high demand.

It is expected to run a certain version of iOS for which it will give more opportunities to the iPhone developers around the world. This new device assumed as the ‘iWatch’ would be a hot favorite among the phone lovers in this year.

At Andolasoft we develop the most intuitive iPhone Applications for our customers. Our experienced developers keep updating their skill set with the latest technology and iOS releases to match the competitive market.