i'm trying to implement a button to increment the album art using Tapku Library and not having much luck.
I was considering replicating a touch using 'touchesBegan' but this is a bit hacky and would rather a cleaner approach.
My code to increment the image, which does not update the image is as follows:
(IBAction)nextImage:(id)sender {
if(imageSelected++ < kNumberOfImages){
coverView.image = [imagesArray objectAtIndex:imageSelected];
[self coverflowView:coverFlow coverAtIndexWasBroughtToFront:imageSelected];
}else{
imageSelected--;
}
}
Can anyone tell me where i might be going wrong? Thanks
Related
I have a UIScrollView with paging enabled, my goal is to detect if the user reaches third page by swiping, I want to redirect the user to another view. I have tried many ways. tried it in scrollViewWillBeginDragging , tried inbuilt pan gesture in scrollview methods using handleSwipeGesture . But unfortunately nothing worked. Can any body please tell me how to face this issue. Thanks in advance.
I recommend you to use this code
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
int page=scrollview.contentoffset.x/scrollview.frame.size.width
if(page == 3)
{
// redirect to your view.
}
}
This will give you the page no. you are currently on. and the condition will redirect to a specified view.
I am trying to set an icon up in the place of this little black square. I could even make it a single letter of text. The trick is, I want to do it based on an attribute of the cell.
So my question is two fold. How do I change that box, and how can I do an if, elseif, else for the three categories the attributes are in?
Let me know what code you'd like to see, and I'll edit here.
Thanks for any help
http://i.imgur.com/NH7L29q.png
**************Edit********************
I've got the syntax for the icons
cell.imageView.image=[UIImage imageNamed:#"Urgent.png"];
Now my question is how do I declare and utilize one of the attributes of the cell/item for my if statement?
Here's my code for the elements in my store
if (self.changeList.count>0) {
for (int i = 0; i < self.changeList.count; i++) {
NSDictionary *coItem = self.changeList[i];
[[BNRItemStore sharedStore]
addItemWithApproverEid:coItem[#"approverEid"]
assignmentGroup:coItem[#"assignmentGroup"]
changeOrder:coItem[#"changeOrder"]
subcategory:coItem[#"subCategory"]
title:coItem[#"title"]
];
You are setting the image in your tableView:cellForRowAtIndexPath, so you have access to all of the data for that cell, just use that data to determine what image you want to show.
Set your default image, then override based on your logic.
I wanna to zoom a group of about 10 sprites at the same time. The sprites are different sprite layers with transparent background.
I'm trying to preattach all the sprite at first to the layer and store the reference in an array. After that as I click the button I do this:
Sorry this is Javascript but in Objective-C it's almost the same.
attr.zoomAllVisibleSprites = function() {
for (var i = 0; i < this.SpriteArray.length; i++) {
if (this.SpriteArray[i].isVisible()) {
this.SpriteArray[i].setAnchorPoint(cc.PointMake(0.5,0.5));
this.SpriteArray[i].setScale(2, 2);
}
}
}
The execution of this little snippet requires on my Android phone about 2-3 seconds which is too much for my game. Is there a way to do it faster, optimize this code. Maybe group in a different way the sprites could help ?
You could replace your array of sprites by using a for-loop for all CCSprites, like this:
for(CCSprite *sprite in self.view.subviews){ //or scenes or whatever
if([sprite isMemberOfClass:[CCSprite class]]){
//Do your thing }}
Might not help alot, but you can atleast ditch the array ;D
It might be the case that device runs out of memory, try switching to 16-bit textures, it can be done by adding this line on start:
CCTexture2D::setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_RGBA4444);
Also you can unload unneeded textures before load new scene, like this:
CCSpriteFrameCache::sharedSpriteFrameCache()->removeUnusedSpriteFrames();
CCTextureCache::sharedTextureCache()->removeUnusedTextures();
CCDirector::sharedDirector()->purgeCachedData();
If that doesn't work then it might be a issue with Open-GL, in that case you should have a look at this. It worked like a magic trick for me.
All the Best.. :)
I am trying to get my brain around what I can and can't reasonably do UI-wise in a multi-platform app. Initially we are only concerned about iOS and Android, but may need a mobile Windows version eventually.
The specific question is: How do I replicate the Android ExpandableListView functionality in iOS? I've tried a few searches, but haven't found a hint. The key I need is collapsible sections. Is that doable with an iOS listview? If so, do you have/know of an example?
The related non-specific question is: What advice do you have for someone just starting out developing in multimobilemono? I've been working from Greg Shackles' excellent book, "Mobile Development in C#" (which has been wildly helpful!), so I've got some basics. But I'm sure there are some hidden landmines when you get into more complex UI design. Any advice would be greatly appreciated.
Thank you!
You can use the UITableView, and merely change the size of your cell to display more content as needed.
Let us discuss DialogViewController (part of MonoTouch.Dialog) which simplifies the setup of a UITableView.
What you could do is create a UIView that contains both the content, and the expanded content. It would be controller with some property, for example:
bool expanded;
public bool Expanded { get { return expanded; }}
set {
if (expanded == value)
return;
Frame = ComputeSize (value);
expanded = value;
}
}
Then, create a UIViewElement:
new RootElement ("My Root") {
new Section () {
new UIViewElement (new MyView ());
}
}
For your first question, perhaps you could try :
https://github.com/OliverLetterer/SLExpandableTableView
I am currently using pagination in a UIScrollView, and for tracking any page change I use;
-(void) scrollViewWillBeginDecelerating:(UIScrollView *)scrollView
{
if (_previousContentOffset > _pageContainer.contentOffset.x)
{
NSLog(#"Less");
_currentPageIdx--;
}
else if (_previousContentOffset < _pageContainer.contentOffset.x)
{
_currentPageIdx++;
NSLog(#"More");
}
}
Now the problem is that, this method isn't tracking the touch fast enough, so when this method is called, the user can be 3 pages along if he/she is paging like a maniac. I tried setting
_pageContainer.decelerationRate = UIScrollViewDecelerationRateFast;
but that didn't make the tracking much faster.
Is there a solution or alternative for this?
Use scrollViewDidScroll: instead. It is being called continuously while the user scrolls.