i had found the page flipper code AFKPageFlipper from github. i want to show image instead of pdf pages which is shown in code example. guys have you any idea how to replace pdf pages into images.
please suggest me.
thanks
Have a look at the example included in the project. You have to implement - (UIView *) viewForPage:(NSInteger) page inFlipper:(AFKPageFlipper *) pageFlipper in the AFKPageFlipperDataSource. In the MainController.m (from the example) you can find a example.
Your new code for images could look like this:
- (UIView *) viewForPage:(NSInteger) page inFlipper:(AFKPageFlipper *) pageFlipper {
// Note that page numbers start at 1 and not 0
switch (page) {
case 1:
//return a view with an image
break;
case 2:
//return a view with an image
break;
default:
break;
}
return nil;
}
Related
I am having some trouble kicking-off with ReactiveCocoa
So basically - I have 2 (potentially N) UIButtons which when tapped on should trigger a different view to be displayed on the screen.
At the moment I am achieving it in the following way:
- (IBAction)firstButtonTapped:(id)sender {
[self processViewDisplayForViewType:ViewTypeFirstType];
}
- (IBAction)secondButtonTapped:(id)sender {
[self processViewDisplayForViewType:ViewTypeSecondType];
}
-(void)processViewDisplayForViewType:(ViewType)viewType{
switch (viewType) {
case ViewTypeFirstType:
//process showing a view based on the given type
break;
case ViewTypeSecondType:
//process showing a view based on the given type
break;
default:
break;
}
self.currentViewType = viewType;
}
Now, if I have other display types I would need to add aditional statements in the switch block... so I hope I can solve this using ReactiveCocoa and FRP. Anybody can point me in the right direction on solving this ?
I am using the GMSIndoorDisplay Class of Google Maps. I can setup a view with a default floor. The user can change the floor by pressing any floor in the list of floors. Is there a way to programatically force the change of floor on an existing loaded ViewController?
I found a way to do it. By saving the current building object we can change the active level of GMSIndoorDisplay and then force a call to the delegate:
- (void) didChangeActiveBuilding: (GMSIndoorBuilding *) building [optional]
This way, the following delegates will be triggered automatically:
- (void) didChangeActiveBuilding: (GMSIndoorBuilding *) building [optional]
- (void) didChangeActiveLevel: (GMSIndoorLevel *) level [optional]
Unfortunately it looks like you can't do this. Each building has a default floor which will be selected when the picker is first displayed.
well, you would need to have all the levels in the building and the current selected floor.
- (void)mapViewDidFinishTileRendering:(GMSMapView *)mapView {
if(!selectlevel)
selectlevel = mapView.indoorDisplay.activeBuilding.defaultLevelIndex;
allLevels = mapView.indoorDisplay.activeBuilding.levels;
}
- (void)down:(id)down {
if(selectlevel>0){
selectlevel = selectlevel -1;
mapView.indoorDisplay.activeLevel = allLevels[selectlevel];
}
}
- (void)up:(id)up {
if(selectlevel< [allLevels count] -1){
selectlevel = selectlevel +1;
mapView.indoorDisplay.activeLevel = allLevels[selectlevel];
}
}
I am developing a content display app in which there is a table view and a detail view. there is a Left menu to browse through different categories in which the content is changing but the display method is same.
I am using AMSlide Menu library for the left menu panel.
Earlier i used Different screens in story board for different categories which had their defined json links from which data is fetched.
But only the json link is changing not the content format so i decided to remove the screens from storyboards and delete the classes. now the app is very light weight but i am not able to set the value of the json link according to the row selected in the left menu.
Following is the code in AmSlide menu segues are performed but when i try to set variable , it giving error
-(NSString *)segueIdentifierForIndexPathInLeftMenu:(NSIndexPath *)indexPath
{
NSString *idetifier = nill;
switch (indexPath.row) {
case 0:
break;
case 1:
idetifier = #"secondSegue";
break;
case 2:
idetifier = #"thirdSegue";
break;
}
return idetifier;
}
I seem to be missing something very simple here.
I have a UIViewController which contains a UISegmentControl with two segments ("shown" & "not shown").
The user selects one in this view controller and fills in some information into text fields which all gets saved to a table view controller.
When I click on a cell to edit the information, I can't get the selected segment to show, so if I select "Not shown" in this cell when saving, I want it to show "Not Shown" selected when I edit the cell.
I then of course want to provide the user the ability to change from "Not Shown" to "Shown" with the UISegmentControl.
My code for saving the UISegment Control in the save method of the creating View Controller is:
contract.wasShown = #(self.isShownSegment.selectedSegmentIndex == 0);
I'm using Core Data here.
So in the detailViewController, I have tried a few things but with no luck (it's always showing the first segment).
if ([contract.wasShown boolValue]) {
contract.wasShown = #(self.isShownSegment.selectedSegmentIndex == 0);
}
else {
contract.wasShown = #(self.isShownSegment.selectedSegmentIndex == 1);
}
What do I need to do to get the selected segment shown and then what should I put in the save method of the Detail View to change that selection if possible?
Thanks!
Sorry all - this was just me being stupid.
Implemented with the following code in viewDidLoad:
if ([contract.wasShown boolValue])
{
self.isShownSegment.selectedSegmentIndex = 0;
}
else
{
self.isShownSegment.selectedSegmentIndex = 1;
}
I am struggling since few days to make this work. I got the Load More link for loading more thumbnails and when I select the link it loads additional records and datasource is updated accordingly. However it doesn't add additional rows and update Load More link with next page indexes. However additional images are added in existing rows, but wouldn't add new rows with additional images.
Is it something I have to change in photoindex after additional records are added from datasource?
I am loading data from sqlite and I have really large number of records. I was looking into other library just because I can't make this work. :(. I still really want to use this library.
Any help in identifying the problem is really appreciated. Thanks in advance
Error was in PhotoSource method which returns maxPhotoIndex.
It has to be in sync with currentPage & number of photos per page.
You should create the subclass of the TTPhotoSource.
Here is my implementation, hope can help you.
#implementation CSCourseListPhotoSource
//return count+1 to display more button
- (NSInteger)numberOfPhotos
{
return [self items].count + 1;
}
- (NSInteger)maxPhotoIndex
{
return [self items].count -1;
}
- (id<TTPhoto>)photoAtIndex:(NSInteger)index
{
if (index < [self items].count) {
...
return photo;
} else {
return nil;
}
}
#end