How can i make infinite chess board

Hello.
for example i want to create an infinite chess board for iphone.
i want to scale it as i want and to ho throw it up, down, left and right.
in what way can i make it? what class to use?
i think UIScrollView, but how? i do not have an image, because it must be infinite
and then i want to add figures to this chess board. for example if user tap on a cell a figure appears.

Hi Mywa, and welcome to the Dev Forums!
I'll try to outline a solution, but I doubt anyone is going to code it for you in a forum, so you'll need some iPhone development experience. As a minimum, make sure you know exactly how the [PageControl|http://developer.apple.com/library/ios/#samplecode/PageControl/Int roduction/Intro.html] sample app works, and have a good understanding of the Tiling example in the [ScrollViewSuite|http://developer.apple.com/library/ios/#samplecode/ScrollViewS uite/Introduction/Intro.html%23//apple_ref/doc/uid/DTS40008904]. It would also help if you're familiar with most of the content in the Scroll View Programming Guide for iOS.
I would start the project by obtaining a 320 x 320 image of your chess board (e.g. a slice of the board containing 8 x 8 squares, each 40 x 40 pixels). For now, you can just package the image as a single UIImageView object in a xib file (later on we might replace this with a custom subclass of UIView which draws either blank or populated squares, but let's do the basics first).
In your board controller's viewDidLoad method, create 9 of these objects, setting the frames to make 3 rows of 3 squares each, and add the 9 objects to a 320 x 320 scrollview so that only the central object is visible. Then set the scroll view's [contentSize|http://developer.apple.com/library/ios/documentation/UIKit/Referen ce/UIScrollViewClass/Reference/UIScrollView.html#//appleref/doc/uid/TP40006922-CH3-SW20] property to 960 x 960 and make sure you can scroll horizontally and vertically to the edges of the grid.
Once you get that part working, you're ready to expand the contentSize and write the code which removes and adds the 320 x 320 image view objects as needed. This is where you'll need to understand the sample apps I recommended. Basically, after each scrolling movement your controller logic needs to decide which image view objects can be released (or recycled), and which grid positions need a new (or reused) image view. The game is to always have an image view ready before any part of an empty grid position becomes visible.
For best performance, the image view objects should be placed in a "reuse" queue when they're removed from the superview, then pulled off the queue as needed, just as cells are managed by UITableView. But the reuse queue is only an optimization, so I would save it for later. For now, I would just release and create. The important thing is to make sure you never need to have very many more than 9 image view objects in memory at any time.
Once you have your "infinite" board operating correctly, you're ready to decide how to store the position of each piece, and how to draw the pieces on the visible squares. If the number of pieces is likely to exceed 1000, you might find the data storage to be more challenging than the drawing, because you'll need to locate pieces fast enough to keep up with scrolling. If the number of 8 x 8 board segments is to be considered infinite, you might not want to store the data for all 64 squares of every segment that's ever been visible. In that case you'll need a "sparse array" that only includes info on populated squares, i.e. one element for each piece instead of one element for each location. I think William gave you some good advice on what data structures to use for this. At some point you might also consider a database to implement your sparse array.
That's probably the best I can do to get you started. I would advise against trying to design all the details ahead of time. E.g., I don't expect you to reply with "Ok, but how do I actually draw the pieces?" until you've got the board working. And I don't expect you to ask how to draw the board until you've become good friends with the recommended sample apps. But once you're seriously into the sample code, we might be able to help with questions like: "I'm trying to calculate which view objects are visible as shown in the layoutSubviews method of [3Tiling/Classes/TiledScrollView.m|http://developer.apple.com/library/ios/sampleco de/ScrollViewSuite/Listings/3_Tiling_Classes_TiledScrollView_m.html#//apple_ref/ doc/uid/DTS40008904-3_Tiling_Classes_TiledScrollView_m-DontLinkElementID26], but ... ". Ok?
\- Ray

Similar Messages

  • **how can i make chess to play online?**

    Hi,
    I want to make a web application which is a game of chess. I want to make it in such a way like on yahoo games. Where two people can play chess. I know how to make it possible to play on a single desktop pc. But how can i make it to play online. I need to know about what java technologies I should learn to make this project possible.
    Regards,
    Fahad Ahemd

    ok but how I dont want to create webserver. I mean I can't affort it at this stage of my education. I can afford a webhosting. there are lot of opitons for webhosting are availabe. I can buy one for me. But I want to know what features of java or anything else should be available on that server. 2nd is what do u mean by socket programming. I understand http programming. It includes servlets and jsps. but what is socket programming and why i need it in this project.
    waiting for reply...
    Fahad Ahmed

  • How can I make a book/podcast listening playlist for a blind person?

    How can I make a book/podcast listening playlist for a blind person? How can lots of content be loaded, so that no navigation is required, for hundreds of hours of enjoyment?
    I wanted to create a single playlist with hundreds of hours of books and podcasts for my grandmother who is blind. Then I planned to use something like the app CarTunes which basically makes the touch screen simply a gigantic pause/play button for an already created playlist.  This is perfect for a blind person. The problem: Apple no longer allows you to have a playlist with Audible Books and Podcasts. I have tried; but the podcasts and books are stripped from the playlist. It seems like all podcast and book players require navigation. (How aggravating!?)
    Any help in creating hundreds of hours long spoken (selected between books and podcasts) audio content playlist for a blind person would be much appreciated!!!!

    Well, good news and bad news. I found out how to tell iTunes that all my music videos are, in fact, actual "music videos" and categorize them as such. In the "Get Info" screen for a track, there is a dropdown selector where you can pick the "meta" type, such as "Music Video", "Home Video", "Movie", "TV Show", etc. This allows iTunes and iOS to think they are all music videos and play them in the same list.
    Unfortunately, this is not compatable with my third party device, which is now refusing to play my music videos in a playlist and will only play them one at a time (in a single-track infinite loop no less). Very frustrating!

  • How can I make my Mac Book Pro print to a Panasonic KX-MB772?

    How can I make my Mac Book Pro OSX 6.8 talk to a Panasonic KX-MB772 printer?

    You can't. The KX-MB722 is one of the few remaining printers in the class of devices called "Windows Printers" that has no on-board printing software -- it relies on a host computer to provide all of the software functionality and Panasonic only provides such software for certain versions of Microsoft Windows. In this case, it means a 32-bit version of Microsoft Windows (2000-XP, though it will probably reliably on Windows versions up to 7). Note that these devices are not guaranteed compatible with future versions of Windows either (Panasonic has already dropped software support for this model).
    I'm pretty sure that the device doesn't support remote printing without the software either (e.g., you can't setup a computer with Windows on it, share the printer, and then print to the shared printer without their software).

  • How can I drop the key board from my calendar. The normal lower right key stopped working

    How can I drop the key board from my calendar? The normal lower right key stopped working.

    You can install this extension to make it easier to edit userChrome.css:
    * ChromEdit Plus: http://webdesigns.ms11.net/chromeditp.html
    The file needs to have this code:
    <pre><nowiki>@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
    #personal-bookmarks #bookmarks-menu-button { display:none !important; }</nowiki></pre>
    You can reach the profile folder this way:
    *Help > Troubleshooting Information > Profile Directory: Open Containing Folder
    The file userChrome.css needs to be in the chrome folder in the [http://kb.mozillazine.org/Profile_folder_-_Firefox Firefox Profile Folder], so if the chrome folder is missing then you need to create a folder with the name chrome.

  • I've been trying to make an account with iTunes n everytime I get to the part of the credit card that's as far as I get because I dnt have one, how can I make an iTunes account without a credit card??

    I've been trying to make an account with iTunes n everytime I get to the part of the credit card that's as far as I get because I dnt have one, how can I make an iTunes account without a credit card??

    Where are you located?
    Just go and buy an iTunes gift card at any store in your country.
    Then follow all the steps you did, but when it asks you for the credit card number, there shoujld be a GIFT CARD option which will let you load your account witht eh funds form the gift card without providing a credit/debit card #.

  • How can i make an iTunes store acount without a credit card?

    how can i make an iTunes store acount without a credit card?
    im israeli and the israel store is only the app store.
    i want to get stuff for free without a credit card.
    help?!?

    Just go get a prepaid Visa or something. Put a small amount of money on it and then use that to open an account. If that doesnt work just call them. Contacting Apple for Support and Service 1 800 275-2273

  • HT1918 how can i make an apple id account without a credit card?

    how can i make an apple id account ? it says i need a credit card but i dont have one how can i get passed this?

    Download a free app, create a new apple id account and click none when it says to fill in credit card information.

  • How can I make mac except capture from my canon xlh1?

    How can I make my imac recognize my canon XL1 Camcorder in Final Cut Express

    Assume you are connected by Firewire, and that FCE has Import in some menu? Also check FCE Forum https://discussions.apple.com/community/professional_applications/final_cut_expr ess_hd?view=discussions.

  • TS3988 When I try and log into the icloud, I get a message that my Apple ID is valid but not an icloud account. How can i make it one?

    Whin I try and long into the icloud, I get a message that my Apple ID is valid, but the it is not an icloud account, how can I make it one?

    To use iCloud on a PC, you must first set it up using a device with iOS5 or a Mac with OS X Lion.

  • I synced two of my email accounts via gmail's POP3 thing. But now my iphone's gmail inbox shows a random selection of emails (not most recent ones that are in my inbox). How can I make my iphone inbox match what I see when I log on using a PC?

    I synced two of my email accounts via gmail's POP3 capabilities. But now my iphone's gmail inbox only shows a random selection of emails (i.e. right now it is May 31, 2013 but the emails in my inbox are a couple from Nov 12, a few from Oct 12, and then some way older than that and so on.When I log into my gmail from a computer, I see all my emails in the logical, standard order. How can I make my iphone inbox match what I see when I log on using a PC?

    If you're trying to decide between using POP and IMAP, we encourage you to use IMAP.
    Unlike POP, IMAP offers two-way communication between your web Gmail and your email client. This means when you log in to Gmail using a web browser, actions you perform on email clients and mobile devices (ex: putting mail in a 'work' folder) will instantly and automatically appear in Gmail (ex: it will already have a 'work' label on that email the next time you sign in).
    IMAP also provides a better method to access your mail from multiple devices. If you check your email at work, on your mobile phone, and again at home, IMAP ensures that new mail is accessible from any device at any given time.
    Finally, IMAP offers a more stable experience overall. Whereas POP is prone to losing messages or downloading the same messages multiple times, IMAP avoids this through two-way syncing capabilities between your mail clients and your web Gmail.
    That is from the page that you linked- does highlighted part of message ring a bell?

  • I down loaded sygic on my iPhone 3s but the icon is missing even in the search but when I want to download it again ,it say this application is present, how can I make the icon to show up

    I down loaded sygic on my iPhone 3s but the icon is missing even in the search but when I want to download it again ,it say this application is present, how can I make the icon to show up

    - Have you tried a reset. Nothing is lost
    Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Try syncing  the iPod to your computer. Then delete from iTunes and sync. that should delete it from the iPod. Then redownload it.

  • I have a new MAC MINI and I want to install a second monitor.  I have one connected to the HDMI and it works.  I can't get a signal to the other one.  It is connected from the thunderbolt to its HDMI port.  How can I make it work?

    I have a new MAC MINI and I want to install a second monitor.  I have one connected to the HDMI and it works.  I can't get a signal to the other one.  It is connected from the thunderbolt to its HDMI port.  How can I make it work?

    Could be a bad cable or bad Thunderbolt port.
    You have 90 days of free telephone support on a new device. You can call them at 1-800-MY-APPLE. Have your Mini's serial number handy
    You can also make an appointment at the Genius Bar of an Apple store.
      Apple Retail Store - Genius Bar

  • I am frustrated with how my cursor jumps around while typing.  How can I make the arrow follow the cursor so this doesn't happen?

    Macbook Pro with OSX Yosemite:  I am frustrated that when using Word for Mac, the cursor keeps jumping around all over the page.  How can I make the pointer follow the cursor so this stops?

    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]

  • My Zoom in Gesture Doesn't Work on Safari How can i make it work?

    I just bought a mac book pro 2011 and i know that the zoom in gesture used to work on safari at first but it doesnt anymore how can i make it work again?

    So it does not work at all in Safari?  Do you have any other web browsers installed that you could test it out on to see if it is just acting up with Safari?

Maybe you are looking for

  • Problem cloning hard disk for 10.6 setup

    Hi all, I just got Snow Leopard for my office MacBook Pro and for my home MacBook. On both machines I got an error message when trying to install it that my partition scheme is not GUID, so 10.6 won't install. First I worked on the MBP. It has a 250

  • How can i stream video from mac os x 10 using roku to my tv?

    how can i stream video from mac os x 10 using roku to my tv?

  • Email form not coming through to inbox

    Hello everyone. I've built a email form in DW CS3 (It's a custom form, not something I got from godaddy or from internet), but when you type in the info, from the form it is not coming to the inbox once you hit send. Can anyone tell me what I'm doing

  • Possible Mail Fix (workaround) with Problem Attachments

    I noticed I had issues sending or building an attachment with the signature option engaged. If you have similar issues and are using a default auto signature insertion, try turning it off and see if that helps. My Brother MFC Scanner/printer wonderfu

  • What is Context Change

    Hi experts plz tell me what is context change